linorobot / linorobot2

Autonomous mobile robots (2WD, 4WD, Mecanum Drive)
Apache License 2.0
436 stars 148 forks source link

ESP32 issues anyone? #119

Open tbalatka opened 2 months ago

tbalatka commented 2 months ago

Hello, I installed Linorobot2 on a laptop running ROS2 Humble. On an ESP32 Wroom, I am running Linorobot2_hardware (Rolling branch). The lidar model I am using is YDLidar2 x4. Both the lidar and ESP32 are connected to the laptop on the robot via USB. The IMU is a MPU6050.

Odom is fine. RZIV2 updates the position of the robot on the grid no problem, as I drive the real robot forward and reverse. But when I turn the direction of the robot, the map generated looks like a Picasso painting, which makes sense since the real robot changed direction but the virtual robot remained pointed in the old direction, resulting in the new perspective of the room superimposed over the old perspective. (hope that makes sense).

There is obviously a break somewhere in communication with respect to the TF data. This is demonstrated in RVIZ2 where I can see the wheels are not rotating when the real robot moves.

To troubleshoot, I ran "ros2 topic echo /tf" and the values under "rotation" show, for example, z: 0.18919803956070486 and w: 0.9819389501523941. Those values change as I move the robot around using teleop_twist_keyboard, but the onscreen wheels remain static as the robot model sort of drifts along the grid.

I've tried both base_serial_port and micro_ros_transport methods on the ESP32, thinking maybe the serial connection or baud rate was at fault. I got the same results.

ROS is new to me and I'm learning as much as I can on my own without assistance -- but this TF issue has me totally stumped.

Any advice would be much appreciated.

BTW, I've included here a photo of my project. It's large (wheels are 8 inches diameter) stands 18" tall. I'm using 12V car seat motors attached to E6B2-CWZ6C encoders. It has incredible torque and it's very quiet (not permitted to have noisy robots in our household...lol). Motor controller consists of two BTS7960 modules. The laptop is an i3. Everything is powered by a 12V 6Ah LiFePO4 Battery. I designed and 3D printed all the parts. image