Skip to content
Snippets Groups Projects
Commit 8339bed1 authored by René Ebeling's avatar René Ebeling
Browse files

Refactor code structure for improved readability and maintainability

parent c8539247
No related branches found
No related tags found
No related merge requests found
LICENSE 0 → 100644
---
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)
Copyright (c) [Year] [Your Name or Organization]
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
Under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- NonCommercial — You may not use the material for commercial purposes.
- ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
---
\ No newline at end of file
......@@ -52,7 +52,7 @@ The project enables a robot to interface with multiple **VL53L7CX** sensors, eac
![VL53L7CX](images/vl53l7cx.jpg)
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.
The **VL53L7CX** sensor provides accurate distance measurements using Time-of-Flight (ToF) technology. It features a 8x8 and 4x4 grid of measurement zones and a refresh rate up up to 15 Mesurements per second, making it ideal for spatial awareness and environmental scanning.
## Features
......@@ -76,16 +76,18 @@ The **VL53L7CX** sensor provides accurate distance measurements using Time-of-Fl
To run this project, you will need the following hardware:
1. **Microcontroller**: Any board compatible with Arduino, such as:
1. **Microcontroller**: Any board compatible with Arduino and two I2C Interfaces, such as:
- **RP2040** (e.g., Raspberry Pi Pico)
2. **VL53L7CX Sensors**:
- At least one **VL53L7CX** sensor, but the project supports up to four sensors at the moment for broader coverage.
- At least one **VL53L7CX** sensor, but the project supports up to 18 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.
- Connect each sensor to the microcontroller via I2C. Ensure proper wiring and distribute the data load evenly by connecting up to 9 sensors per I2C interface.
4. **LED for Status**:
4. **PCF8575 Modules**:
- Two **PCF8575 I2C GPIO expanders** are used during initialization to enable and disable I2C communication with each sensor. This allows assigning unique I2C addresses to the sensors dynamically.
5. **LED for Status**:
- An onboard LED or external LED connected to the **LED_BUILTIN** pin for visual feedback.
### Wiring Diagram Example
......@@ -125,7 +127,7 @@ The VL53L7CX sensors are configured to operate in an 8x8 grid mode, providing 64
### 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.
The process of measuring distances using the VL53L7CX sensors is called **ranging**. 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 and the status of all measurements. The formatted data is transmitted to the ROS2 node for further processing.
## Example Output
......@@ -133,19 +135,29 @@ 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],
...
]
"sensor0": [[18,5],[22,5],[37,5],[215,5],[183,5],[184,5],[211,5],[961,255],[24,5],[1010,5],[819,5],[922,5],[899,5],[950,5],[909,5],[951,5],[263,255],[256,5],[911,5],[1023,5],[950,255],[933,5],[225,5],[953,5],[993,5],[999,5],[1044,5],[1000,5],[994,5],[980,5],[976,5],[972,5],[969,5],[967,5],[965,5],[963,5],[962,5],[960,5],[959,5],[958,5],[957,5],[956,5],[955,5],[954,5],[952,5],[951,5],[950,5],[949,5],[948,5],[947,5],[946,5],[945,5],[944,5],[943,5],[942,5],[941,5],[940,5],[939,5],[938,5],[937,5],[936,5],[935,5],[934,5]],
"sensor1": [[111,5],[222,5],[333,5],[444,5],[555,5],[666,5],[777,5],[888,5],[999,5],[1000,5],[1010,5],[1020,5],[1030,5],[1040,5],[1050,5],[1060,5],[1070,5],[1080,5],[1090,5],[1100,5],[1110,5],[1120,5],[1130,5],[1140,5],[1150,5],[1160,5],[1170,5],[1180,5],[1190,5],[1200,5],[1210,5],[1220,5],[1230,5],[1240,5],[1250,5],[1260,5],[1270,5],[1280,5],[1290,5],[1300,5],[1310,5],[1320,5],[1330,5],[1340,5],[1350,5],[1360,5],[1370,5],[1380,5],[1390,5],[1400,5],[1410,5],[1420,5],[1430,5],[1440,5],[1450,5],[1460,5],[1470,5],[1480,5],[1490,5],[1500,5],[1510,5],[1520,5],[1530,5],[1540,5],[1550,5],[1560,5]],
"sensor2": [[201,5],[202,5],[203,5],[204,5],[205,5],[206,5],[207,5],[208,5],[209,5],[210,5],[211,5],[212,5],[213,5],[214,5],[215,5],[216,5],[217,5],[218,5],[219,5],[220,5],[221,5],[222,5],[223,5],[224,5],[225,5],[226,5],[227,5],[228,5],[229,5],[230,5],[231,5],[232,5],[233,5],[234,5],[235,5],[236,5],[237,5],[238,5],[239,5],[240,5],[241,5],[242,5],[243,5],[244,5],[245,5],[246,5],[247,5],[248,5],[249,5],[250,5],[251,5],[252,5],[253,5],[254,5],[255,5],[256,5],[257,5],[258,5],[259,5],[260,5],[261,5],[262,5],[263,5],[264,5]],
"sensor3": [[256,5],...,[673,255]],
"sensor4": [[256,5],...,[673,255]],
"sensor5": [[256,5],...,[673,255]],
"sensor6": [[256,5],...,[673,255]],
"sensor7": [[256,5],...,[673,255]],
"sensor8": [[256,5],...,[673,255]],
"sensor9": [[256,5],...,[673,255]],
"sensor10": [[256,5],...,[673,255]],
"sensor11": [[256,5],...,[673,255]],
"sensor12": [[256,5],...,[673,255]],
"sensor13": [[256,5],...,[673,255]],
"sensor14": [[256,5],...,[673,255]],
"sensor15": [[256,5],...,[673,255]],
"sensor16": [[256,5],...,[673,255]],
"sensor17": [[256,5],...,[673,255]]
}
```
This JSON object can be easily parsed and used for tasks such as obstacle avoidance and path planning.
This JSON object can be easily parsed.
## License
......
Wiring/VL53L7CX_ICON.png

10.7 KiB

This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment