SJSURoboticsTeam / urc-intelligent-systems-2023

Intelligent Rover Systems for University Rover Challenge. Involves Computer Vision & Algorithm Pathing for autonomous exploration.
6 stars 4 forks source link

Mock Sensor Implementation #72

Closed Maaz0070 closed 1 year ago

Maaz0070 commented 1 year ago

GitHub Issue: Create Mock Sensors for Autonomous Systems Project

Description: As part of enhancing the testing capabilities of the Autonomous Systems, we need to create mock sensor classes for all the sensors used in the project. These mock sensor classes will simulate the behavior of real sensors by providing random data for testing various functionalities.

Mock Sensor Implementation:

  1. MockBN08x:

    • Simulates an IMU sensor (BN08x) and provides random acceleration, gyro, magnetic, and rotation values.
  2. MOCKLSM303:

    • Simulates an LSM303 sensor and provides random acceleration and magnetic field values.
  3. MOCKWiFi:

    • Simulates a WiFi module and allows the testing of WiFi-related functionalities.
  4. MOCKGPS:

    • Simulates a GPS sensor and provides random latitude, longitude, altitude, and velocity values.
  5. MOCKMPU6050:

    • Simulates an MPU6050 sensor and provides random acceleration and gyro values.
  6. MOCKRPLIDAR:

    • Simulates an RPLIDAR sensor and allows the testing of LiDAR-related functionalities.
  7. MOCKSerial:

    • Simulates a serial communication module and provides random data transmission behavior.
  8. MOCKIR_Sensor:

    • Simulates an IR sensor and provides random distance/proximity values.
  9. MOCKStereoCamera:

    • Simulates a stereo camera and provides random image data for testing computer vision functionalities.

Steps:

  1. Create the mock sensor classes in the modules directory of the project.

  2. Implement the necessary methods in each mock sensor class to provide random data similar to the real sensors.

  3. Create a separate branch named feature/mock-sensors branching off from the main branch.

  4. Commit the new mock sensor classes to the feature/mock-sensors branch.

  5. Test the mock sensors by writing unit tests in the respective test files.

  6. Once the mock sensors are fully tested and verified, create a pull request to merge the branch into the main branch.

File Changes: Autonomous_Systems/ └── modules/ ├── BN08x.py ├── GPS.py ├── IR_Sensor.py ├── LSM303.py ├── MOCKBN08x.py # New ├── MOCKLSM303.py # New ├── MOCKWiFi.py # New ├── MOCKGPS.py # New ├── MOCKMPU6050.py # New ├── MOCKRPLIDAR.py # New ├── MOCKSerial.py # New ├── MOCKIR_Sensor.py # New ├── MOCKStereoCamera.py # New ├── MPU6050.py ├── RPLIDAR.py ├── Serial.py ├── WiFi.py

Testing:

Expected Outcome:

Additional Notes:

Future Scope

LucasStevenson commented 1 year ago

i ran the mock classes through the test files in demos/ and they all worked fine

suhailskhan commented 1 year ago

Future Scope

  • Look into making a mock scenario file that mimics the rover moving closer to a target GPS position

Possible approach, as discussed with @Maaz0070 : Record a sample of actual sensor values while rover is moving to a GPS coordinate.

Cc @LucasStevenson