ROS Node to interact with imu
-
Create ros2 C++ package
ros2 pkg create --build-type ament_cmake --node-name encoders encoders
-
Build package
colcon build --packages-select encoders
-
Source the setup file
. install/setup.bash
-
Use the package
ros2 run encoders encoders
-
Customize package.xml
It connects to i2c with the i2c_server node.
This package interact with an ESP32 board installed on the Maile Vehicle. The communication is made on I2C where the board has been setup as a SLAVE with ID:0x09.
<<<<<<< Updated upstream
- Read 0x09
- It will respond with 1 byte, how many encoders are programmed (uint8_t)
- Read 0x10
- It will respond with (4+2*N_ENCODERS) bytes; first 4 bytes are microsecods from last call (uint32_t) after that, 2 bytes for each programmed encoder counting tick from the last call (uint16_t) the encoders order is:
- spur gear motor encoder
- front right wheel encoder
- rear right wheel encoder
- rear left wheel encoder
- front left wheel encoder
NOTES
-
spur gear (high gear ratio = 1:5.22, low gear ratio = 1:14.45)
-
tick at spur gear / round = 10
-
wheel circumference = 0.559 meter
-
tick for wheel / round = 12
=======
- Read 0x20
- It will respond with (9*4) bytes; 4 bytes for each value (float32_t) the order is:
- acceleration on X (m/s)
- acceleration on Y (m/s)
- acceleration on Z (m/s)
- gyro on X (rad/s)
- gyro on Y (rad/s)
- gyro on Z (rad/s)
- mag on X (uT)
- mag on Y (uT)
- mag on Z (uT)
Stashed changes
This software contains code licensed as described in LICENSE.