ros-mobile-robots / diffbot

DiffBot is an autonomous 2wd differential drive robot using ROS Noetic on a Raspberry Pi 4 B. With its SLAMTEC Lidar and the ROS Control hardware interface it's capable of navigating in an environment using the ROS Navigation stack and making use of SLAM algorithms to create maps of unknown environments.
https://ros-mobile-robots.com
BSD 3-Clause "New" or "Revised" License
275 stars 82 forks source link

Bosh BNO055 IMU implementation #37

Open YohanBorda opened 2 years ago

YohanBorda commented 2 years ago

Hi fjp,

The IMU has been implemented to the "low-level", using an Arduino Mega, the same implementation should work with you hardware (teensy board).

I found some challenges with your new encoders implementation (now using the EncoderStamped message) as the message format is now different, which introduces the a problem as the hardwareinterface is not being able to subscribe to the encoders topic published by the MCU, maybe you can review it and fix this linking problem. If possible, can you please share the solution?

I manage to verify that the IMU was publishing before and after the EKF filter successfully, however there is more potential adjustments required. We will be doing some tests with our hardware in the next weeks, if I find something extra required or nice to haves, I will let you know.

Changes:

-EKF Filter added to diffbot_control/conf, this needs testing to adjust it to your hardware.

rsilverioo commented 2 years ago

@YohanBorda Why did you use this configuration for robot_localization? Did you do any more tests at the end?

I am going to start from this configuration, which is intended for a good IMU and poor odometry, and test if the odometry calculated with the encoders is good enough to add it or not.

odom0: /diffbot/mobile_base_controller/odom

odom0_config: [false, false, false, # X, Y, Z
               false, false, false, # roll, pitch, yaw
               true,  true,  true,  # X',Y',Z'
               false, false, true,  # roll',pitch',yaw'
               false, false, false] # X'',Y'',Z''
odom0_differential: false
odom0_queue_size: 10

imu0: /diffbot/imu/processed
imu0_config: [false, false, false,  # X, Y, Z
              true,  true,  true,   # roll, pitch, yaw
              false, false, false,  # X',Y',Z'
              true,  true,  true,   # roll',pitch',yaw'
              false, false, false]  # X'',Y'',Z''

Also check that everything works correctly. I'm currently tuning the navigation stack and I'm following these guides: http://wiki.ros.org/navigation/Tutorials/Navigation%20Tuning%20Guide https://kaiyuzheng.me/documents/navguide.pdf

If I am convinced by the results of the tests, I will tell you about them here ^^

YohanBorda commented 2 years ago

@rsilverioo I did that configuration as a starting point, it is not fully tuned and it changes depending on your robot. For example in my project, I will be using another EKF stack with GPS as this is more suitable for my application, so in my case, these values will be different due to the GPS will cover some parameters that the IMU doesn't need to.

Also, I have been working on the hardware (calibrating the IMU, setting PID, procuring reliable motor drivers, and motors ) before I start tunning the EKF. I consider it is better to start correcting from the low level.

To be honest I haven't reached the point to calibrate EKF as we are trying to get the low level and hardware as stable as possible before we move on to the filters. So, getting your feedback on how you tuned the navigation stack would be well appreciated. :)

fjp commented 2 years ago

Thanks a lot @YohanBorda for this PR and please excuse the long wait on reviewing this. I plan to include at least some files/code you have provided! However I need some time to test this.

Please also note that you modified the deprecated encoder.ino script (encoder_imu.ino in your case). There is a new base_controller which I plan to adapt to publish the IMU data, here in this loop:

https://github.com/ros-mobile-robots/diffbot/blob/e04c7dd98b2d2132005dd15b9f85eac0b01515af/diffbot_base/scripts/base_controller/src/main.cpp#L53-L70

This will be known as the low level approach.

In case you are looking for a high level solution, there is also another open PR #60 which connects the IMU directly to the SBC via i2c. I think you might find this useful as well.

Anyway, thanks again for this PR, I will definitely try both, the low level solution you provided and the high level approach.