Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wheel_radius problem #79

Open
hsynklceng opened this issue Feb 23, 2023 · 2 comments
Open

wheel_radius problem #79

hsynklceng opened this issue Feb 23, 2023 · 2 comments

Comments

@hsynklceng
Copy link

Hi,
I use diffbot package on my robot. I revised the parameters according to my own robot. But i have a problem. If I set the wheel_radius parameter to 1, all the values are correct, but if I set it to its real value for wheel_radius, the odom and desired_position datas are corrupted.
How can i fix this problem?
Thank you

@fjp
Copy link
Member

fjp commented Feb 24, 2023

Hi @hsynklceng thanks for using diffbot. Let me try to get more insight in your problem as I didn't encounter it so far with Diffbot or REMO.

First of all, where are you setting the wheel_radius? And are you using the high-level or low-level PID approach? I am assuming the low-level PID approach which is based on the mcu firmware scripts in diffbot_base/scripts/base_controller.

If I set the wheel_radius parameter to 1, all the values are correct, but if I set it to its real value for wheel_radius, the odom and desired_position datas are corrupted.

Regarding the wheel radius definition, Diffbot and REMO use also use 0.0325 m (3.25 cm), defined here:

# Wheel separation and diameter. These are both optional.
# diff_drive_controller will attempt to read either one or both from the
# URDF if not specified as a parameter
wheel_separation : 0.145
wheel_radius : 0.0325

And I didn't encounter any odom issues. A value of 1 would mean a wheel with a diameter of 2 meter. Which value did you set and which desired_position calculation are you referring to? A link to the code location would help me to give better support.

Other adaptations

It is also a good idea to update the wheel radius in your URDF. For example here (diffbot) and here (REMO), but this should only be relevant for simulation. The real robot reads the wheel_radius from the parameter server.

One thing that you also have to adapt - in case you have different motors/encoders - is to set the number of encoder ticks for one full revolution. The important file where to set it is here:

encoder_resolution: 542

The one defined in the diffbot_base_config should be only relevant for testing, but it is a good idea to also set it correctly:

Another important thing is the PID tuning:

#define K_P 0.6 // P constant
#define K_I 0.3 // I constant
#define K_D 0.5 // D constant

Let me know if you are not using the low-level PID approach. Then the PID tuning looks a bit different.

@hsynklceng
Copy link
Author

firstly, thanks for answer

First of all, where are you setting the wheel_radius? And are you using the high-level or low-level PID approach? I am assuming the low-level PID approach which is based on the mcu firmware scripts in

I set on diffbot_control.yaml and yes i am using low-level PID on mcu. By the way, my wheel radius is 7.5 cm(0.075).

And I didn't encounter any odom issues. A value of 1 would mean a wheel with a diameter of 2 meter. Which value did you set and which desired_position calculation are you referring to? A link to the code location would help me to give better support.

I solved the odometry problem, it was caused by a code error in my mcu. And If I add the parameter publish_wheel_joint_controller_state: True to diffbot_control.yaml, the topic containing the desired_position will be active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants