diff --git a/Progress_documentation/Screencast from 01-23-2025 05:32:14 PM.webm b/Progress_Documentation/Screencast from 01-23-2025 05:32:14 PM.webm similarity index 100% rename from Progress_documentation/Screencast from 01-23-2025 05:32:14 PM.webm rename to Progress_Documentation/Screencast from 01-23-2025 05:32:14 PM.webm diff --git a/Progress_documentation/Screencast from 01-23-2025 05:44:45 PM.webm b/Progress_Documentation/Screencast from 01-23-2025 05:44:45 PM.webm similarity index 100% rename from Progress_documentation/Screencast from 01-23-2025 05:44:45 PM.webm rename to Progress_Documentation/Screencast from 01-23-2025 05:44:45 PM.webm diff --git a/Progress_documentation/Screencast from 01-24-2025 05:32:23 PM.webm b/Progress_Documentation/Screencast from 01-24-2025 05:32:23 PM.webm similarity index 100% rename from Progress_documentation/Screencast from 01-24-2025 05:32:23 PM.webm rename to Progress_Documentation/Screencast from 01-24-2025 05:32:23 PM.webm diff --git a/Progress_documentation/rviz2_screencast_1512025.mp4 b/Progress_Documentation/rviz2_screencast_1512025.mp4 similarity index 100% rename from Progress_documentation/rviz2_screencast_1512025.mp4 rename to Progress_Documentation/rviz2_screencast_1512025.mp4 diff --git a/README.md b/README.md index d9507629a0dd1b4843d6c6ba54c543309dad7930..e909242f5597e3068736fb601a3eec7956c7071c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Robot Sensor Project -This repository contains code for interfacing multiple **VL53L5CX Time-of-Flight (ToF) sensors** with a robot system. The sensors measure distance in a 4x4 grid and communicate through the I2C protocol. The sensor data is collected and formatted into a **JSON object**, which can be used for robot navigation, obstacle detection, or mapping. +This repository contains code for interfacing multiple **VL53L7CX Time-of-Flight (ToF) sensors** with a robot system. The sensors measure distance in a 4x4 grid and communicate through the I2C protocol. The sensor data is collected and formatted into a **JSON object**, which can be used for robot navigation, obstacle detection, or mapping. ## Table of Contents @@ -21,21 +21,32 @@ This repository contains code for interfacing multiple **VL53L5CX Time-of-Flight ## Overview -The project enables a robot to interface with multiple **VL53L5CX** sensors, each configured to measure distances in a 4x4 grid pattern. The robot uses these sensors to gather distance data, which is then formatted as a JSON object for easier handling and integration into robot control systems. The data can be utilized for tasks such as obstacle avoidance, path planning, and more. +The project enables a robot to interface with multiple **VL53L7CX** sensors, each configured to measure distances in a 8x8 grid pattern. The robot uses these sensors to gather distance data, which is then formatted as a JSON object for easier handling and integration into robot control systems. The data can be utilized for tasks such as obstacle avoidance, path planning, and more. -### Sensor Example (VL53L5CX) +### Sensor Example (VL53L7CX) - + -The **VL53L5CX** sensor provides accurate distance measurements using Time-of-Flight (ToF) technology. It features a 4x4 grid of measurement zones, making it ideal for spatial awareness and environmental scanning. +The **VL53L7CX** sensor provides accurate distance measurements using Time-of-Flight (ToF) technology. It features a 8x8 and 4x4 grid of measurement zones, making it ideal for spatial awareness and environmental scanning. ## Features -- **Multiple Sensor Support**: Handles up to four VL53L5CX sensors connected via I2C. +- **Multiple Sensor Support**: Handles up to four VL53L7CX sensors connected via I2C and will be updated to handle 18 Sensors - **Configurable Parameters**: Allows setting the sensor's I2C address, resolution (8x8 grid), and ranging frequency. - **JSON Output**: Collects and formats the sensor data into a JSON object, which can be easily transmitted or stored. - **LED Status Indication**: Provides LED feedback to indicate when data is being processed. - **Integration Ready**: Output is designed to be easily integrated into larger systems for navigation or environmental mapping. +- **Custom PCB**: Includes a custom PCB design for the VL53L7CX sensors and wiring schematics available in the `wiring` directory. + +<p float="left"> + <img src="images/PCB_3D.jpg" alt="PCB Design" width="45%" /> + <img src="images/PCB_Wiring.jpg" alt="PCB Wiring" width="45%" /> +</p> + +- **Custom Sensor Holder**: Includes a custom-designed sensor holder available in the `CAD_Design` directory for optimal sensor placement and stability. Multiple versions are provided, along with the f3z Fusion files for further customization. + + +- **Progress Documentation**: Includes a `Progress_Documentation` directory containing videos that demonstrate the functionality and progress of the project. These videos provide visual insights into the sensor setup, data collection process, and integration with the robot system. ## Hardware Requirements @@ -43,11 +54,9 @@ To run this project, you will need the following hardware: 1. **Microcontroller**: Any board compatible with Arduino, such as: - **RP2040** (e.g., Raspberry Pi Pico) - - **STM32** boards - - **SAM-based** Arduino boards -2. **VL53L5CX Sensors**: - - At least one **VL53L5CX** sensor, but the project supports up to four sensors for broader coverage. +2. **VL53L7CX Sensors**: + - At least one **VL53L7CX** sensor, but the project supports up to four sensors at the moment for broader coverage. 3. **I2C Connections**: - Connect each sensor via I2C to the microcontroller. Ensure proper wiring and pull-up resistors are in place. @@ -59,19 +68,41 @@ To run this project, you will need the following hardware: Below is an example wiring diagram for connecting the sensors to your microcontroller. - + -Make sure to connect the **SCL** and **SDA** lines for I2C communication, as well as **VCC** and **GND** for power. +Make sure to connect the **SCL** and **SDA** lines for I2C communication, as well as **VIN** and **GND** for power. ## Software Requirements - **Arduino IDE** (or compatible IDE like PlatformIO). -- **Libraries**: - - **Wire**: For I2C communication. - - **ArduinoJson**: For parsing and handling JSON data. - - **VL53L5CX**: Library for controlling the VL53L5CX sensors. +- **Arduino Libraries**: + - **Wire**: For I2C communication. + - **ArduinoJson**: For parsing and handling JSON data. + - **VL53L7CX**: Library for controlling the VL53L7CX sensors. +- **Python Packages**: + - **trimesh**: Library for handling and visualizing 3D meshes. + - **rclpy**: Standard ROS2 library for writing Python nodes. + - **numpy**: Library for numerical operations in Python. + - **scipy**: Library for scientific and technical computing, used here for spatial transformations. + - **tf2_ros**: ROS2 library for keeping track of coordinate frames over time. + - **sensor_msgs**: ROS2 message types for sensor data, including PointCloud2. + - **std_msgs**: Standard ROS2 message types, including Header. + +### Step 1: Install Arduino Librarys + +You can install the required Arduino libraries from the Arduino Library Manager or by downloading them from GitHub. + +### Step 2: Install Python Packages + +Navigate to the project directory and install the required Python packages using `pip`: + +```bash +cd robot-sensor +pip install trimesh rclpy numpy scipy tf2_ros sensor_msgs std_msgs +``` + +Make sure you have a compatible version of Python installed (e.g., Python 3.6 or later). -You can install the required libraries from the Arduino Library Manager or by downloading them from GitHub. ## Installation @@ -81,3 +112,103 @@ First, clone the repository to your local machine: ```bash git clone https://git-ce.rwth-aachen.de/rene.ebeling/robot-sensor.git +cd robot-sensor +``` + +### Step 2: Install Arduino Libraries + +Open the Arduino IDE and install the required libraries from the Library Manager: + +1. Go to **Sketch** > **Include Library** > **Manage Libraries**. +2. Search for and install the following libraries: + - **Wire** + - **ArduinoJson** + - **VL53L7CX** + +### Step 3: Install Python Packages + +Navigate to the project directory and install the required Python packages using `pip`: + +```bash +pip install trimesh rclpy numpy scipy tf2_ros sensor_msgs std_msgs +``` + +Make sure you have a compatible version of Python installed (e.g., Python 3.6 or later). + +### Step 4: Upload the Code to the Microcontroller + +Connect your microcontroller to your computer and upload the provided Arduino sketch: + +1. Open the Arduino IDE. +2. Open the sketch file located in the `arduino` directory of the cloned repository. +3. Select the appropriate board and port from the **Tools** menu. +4. Click **Upload** to upload the code to the microcontroller. + +### Step 5: Run the ROS2 Node + +Once the microcontroller is set up and running, execute the ROS2 node to start collecting and processing sensor data: + +```bash +ros2 run ser_test ser_test_node +ros2 run ser_test pcl_rob_node +``` + +Alternatively, you can execute the following command to launch the UR simulation with Gazebo and MoveIt: + +```bash +ros2 launch ur_simulation_gazebo ur_sim_moveit.launch.py +``` + +This will start the simulation environment, allowing you to test the sensor integration in a virtual setup. +In the launch file are the ser_test_node and the pcl_rob_node included. + + +## How It Works + +### Sensor Configuration + +The VL53L7CX sensors are configured to operate in an 8x8 grid mode, providing 64 distance measurements per sensor. Each sensor is assigned a unique I2C address to enable communication with the microcontroller. The configuration parameters, such as the I2C address and ranging frequency, can be adjusted in the Arduino sketch. + +### Data Collection + +The microcontroller collects distance data from each sensor via the I2C bus. The data is then processed and formatted into a JSON object. This JSON object includes the distance measurements from all sensors. The formatted data is transmitted to the ROS2 node for further processing. + +## Example Output + +Below is an example of the JSON output generated by the system: + +```json +{ + "sensor1": [ + [100, 110, 120, 130, 140, 150, 160, 170], + [105, 115, 125, 135, 145, 155, 165, 175], + ], + "sensor2": [ + [200, 210, 220, 230, 240, 250, 260, 270], + [205, 215, 225, 235, 245, 255, 265, 275], + ... + ] +} +``` + +This JSON object can be easily parsed and used for tasks such as obstacle avoidance and path planning. + +## License + +This project is licensed under the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for more details. + +## Troubleshooting + +### Common Issues + +1. **Sensor Not Detected**: Ensure that the I2C connections are secure and that each sensor has a unique I2C address. When you change the Arduino code, you have to unplug the microcontroller once so the I2C addresses from the sensors are reset to the default address, allowing the setup function to reassign the new addresses. +2. **Microcontroller Not Responding**: Check the power supply and ensure that the microcontroller is properly connected to the computer. + +### Debugging Tips + +- Use the Arduino Serial Monitor to print debug information and verify sensor data. +- Check the wiring and connections for any loose or incorrect connections. +- Ensure that all required libraries are installed and the correct Version is installed. + +For further assistance, refer to the project's documentation, submit an Issue, or write me an E-Mail. + diff --git a/images/Screenshot 2025-02-09 221521.jpg b/images/PCB_3D.jpg similarity index 100% rename from images/Screenshot 2025-02-09 221521.jpg rename to images/PCB_3D.jpg diff --git a/images/Screenshot 2025-02-08 234620.jpg b/images/PCB_Wiring.jpg similarity index 100% rename from images/Screenshot 2025-02-08 234620.jpg rename to images/PCB_Wiring.jpg diff --git a/images/Screenshot 2025-01-20 013459.jpg b/images/Sensor_holder.jpg similarity index 100% rename from images/Screenshot 2025-01-20 013459.jpg rename to images/Sensor_holder.jpg diff --git a/images/Wiring_Schematic.png b/images/Wiring_Schematic.png new file mode 100644 index 0000000000000000000000000000000000000000..4ef3e1b46448d3843064e6ce2f464d65c7d34338 Binary files /dev/null and b/images/Wiring_Schematic.png differ diff --git a/images/vl53l7cx.jpg b/images/vl53l7cx.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aa2f85afa2b9e2e37fc5d4d2bc8be41b71504e5c Binary files /dev/null and b/images/vl53l7cx.jpg differ diff --git a/workspaces/rescale.py b/workspaces/rescale.py deleted file mode 100644 index d35f0e5611ee31ca58bda6c0a718a205786536c4..0000000000000000000000000000000000000000 --- a/workspaces/rescale.py +++ /dev/null @@ -1,33 +0,0 @@ -import trimesh -import argparse -import collada - -def rescale_mesh(input_file, output_file, scale_factor): - # Load the mesh from the input file - mesh = trimesh.load(input_file) - - # Apply the scaling transformation - mesh.apply_scale(scale_factor) - - # Export the rescaled mesh to a temporary file in a supported format - temp_file = "temp_rescaled.stl" - mesh.export(temp_file) - - # Load the temporary file with pycollada and save as .dae - mesh_collada = collada.Collada(temp_file) - mesh_collada.write(output_file) - - print(f"Mesh rescaled by a factor of {scale_factor} and saved to {output_file}") - -if __name__ == "__main__": - - # Parse command line arguments - parser = argparse.ArgumentParser(description="Rescale a mesh using trimesh") - parser.add_argument("input_file", type=str, help="Path to the input mesh file") - parser.add_argument("output_file", type=str, help="Path to the output mesh file") - parser.add_argument("scale_factor", type=float, help="Scaling factor to apply to the mesh") - - args = parser.parse_args() - - # Rescale the mesh - rescale_mesh(args.input_file, args.output_file, args.scale_factor) \ No newline at end of file diff --git a/workspaces/temp_rescaled.stl b/workspaces/temp_rescaled.stl deleted file mode 100644 index aa98996861fe1ea09e2030159b698ef458fcd4ff..0000000000000000000000000000000000000000 Binary files a/workspaces/temp_rescaled.stl and /dev/null differ diff --git a/workspaces/vl53l7cx.dae b/workspaces/vl53l7cx.dae deleted file mode 100644 index 7998516a4d61513b72be3a352459bd4668f6a1d2..0000000000000000000000000000000000000000 Binary files a/workspaces/vl53l7cx.dae and /dev/null differ diff --git a/workspaces/vl53l7cx.stl b/workspaces/vl53l7cx.stl deleted file mode 100644 index 25e693fe915d28329a4502a89bbf711955d054b1..0000000000000000000000000000000000000000 Binary files a/workspaces/vl53l7cx.stl and /dev/null differ diff --git a/workspaces/vl53l7cx1.dae b/workspaces/vl53l7cx1.dae deleted file mode 100644 index 7998516a4d61513b72be3a352459bd4668f6a1d2..0000000000000000000000000000000000000000 Binary files a/workspaces/vl53l7cx1.dae and /dev/null differ diff --git a/workspaces/vl53l7cx1.stl b/workspaces/vl53l7cx1.stl deleted file mode 100644 index fdd48bab0718d007f0605c2db77e739fab8f00d3..0000000000000000000000000000000000000000 Binary files a/workspaces/vl53l7cx1.stl and /dev/null differ