How to know how many meters the robot has moved if publish an acceleration to /cmd_vel

asked 2021-04-22 09:44:08 -0500

Rikyuugo gravatar image

updated 2021-04-22 09:47:28 -0500

The position of the robot on the map is different from its actual position.At the same time, the radar does not match the map. I read an article, saying that it is caused by the error of odometer data and gyroscope data. The odometer error is due to the cmd_vel data or keyboard operation is given, the linear velocity of the robot does not reach the given linear velocity.If I want to solve this problem, I need to adjust the PID. But I don't know how to find the chassis configuration file, and if I send an acceleration to the chassis, how many meters the robot will move (I try to send x = 1, but the robot only moves slightly) Is it because of the chassis control problem or my AMCL configuration problem or others?Thanks a lot.

This is my amcl param <launch> <node name="amcl" type="amcl" pkg="amcl" output="screen">

    <param name="kld_err" value="0.015"/>
    <param name="kld_z" value="0.99"/>

    <param name="update_min_d" value="0.05"/>
    <param name="update_min_a" value="0.03"/>
    <param name="resample_interval" value="1"/>
    <param name="transform_tolerance" value="0.0"/>
    <param name="recovery_alpha_slow" value="0.01"/>
    <param name="recovery_alpha_fast" value="0.1"/>
    <param name="gui_publish_rate" value="10.0"/>
    <param name="save_pose_rate" value="0.5"/>
    <param name="use_map_topic" value="false"/>

    <param name="first_map_only" value="false"/>

    <param name="laser_min_range" value="-1.0"/>

    <param name="laser_max_range" value="-1.0"/>

    <param name="laser_max_beams" value="500"/>
    <param name="laser_z_hit" value="0.5"/>
    <param name="laser_z_short" value="0.05"/>
    <param name="laser_z_max" value="0.05"/>
    <param name="laser_z_rand" value="0.05"/>
    <param name="laser_sigma_hit" value="0.12"/>
    <param name="laser_lambda_short" value="0.1"/>
    <param name="laser_likehood_max_dist" value="2.0"/>

    <param name="laser_model_type" value="likelihood_field"/>
    <param name="odom_model_type" value="diff"/>
    <param name="odom_alpha1" value="12.2"/>
    <param name="odom_alpha2" value="12.3"/>
    <param name="odom_alpha3" value="12.2"/>
    <param name="odom_alpha4" value="12.2"/>
    <param name="odom_alpha5" value="0.1"/>

    <param name="odom_frame_id" value="/odom"/>
    <param name="base_frame_id" value="/base_link"/>
    <param name="global_frame_id" value="/map"/>
    <param name="tf_broadcast" value="ture"/>

    <param name="initial_pose_x" value="0.000"/>
    <param name="initial_pose_y" value="0.000"/>
    <param name="initial_pose_a" value="0.000"/>
    <param name="initial_cov_xx" value="0.5*0.5"/>
    <param name="initial_cov_yy" value="0.5*0.5"/>
    <param name="initial_cov_aa" value="(π/12)*(π/12)"/>


image description image descriptionimage description

edit retag flag offensive close merge delete


Without too much familiarity on your specific setup, I can offer some general feedback. Odometry errors could arise from a number of places. Ideally you would have wheel or motor encoders that measure the wheel/motor position directly and use these values to estimate the robot's current position rather than trying to use the command input; odometric accuracy also depends on the assumption that the wheels are not slipping, there is negligible backlash, etc.

If you don't have encoder data and need to estimate motion using command inputs, then you need to make sure inputs are matching your hardware's output. Ramping up speed slowly could help here.

You can dead-reckon using acceleration (double integrate acceleration to get position) though you would need to be aware of hardware limits here (e.g. max speed, min input).

Its strange that AMCL isn't doing a better job of correcting ...(more)

shonigmann gravatar image shonigmann  ( 2021-04-22 12:40:22 -0500 )edit

@shonigmann Sorry for the late reply. What should I do to check up whehter inputs are matching my hardware's output? If I want the robot to move forward 1 meter,can I do it by publishing an x=1 to the /cmd_vel topic once?

Rikyuugo gravatar image Rikyuugo  ( 2021-04-23 21:22:01 -0500 )edit

much of this will come down to your specific hardware/firmware/motor control strategy. /cmd_vel will set the robot's targetvelocity and it will try to meet that as best as it can. but velocity =/= position. You have to integrate velocity to get position. If you set a velocity of 1 m/s for 1 second, you would expect a perfect system to move 1m. In reality, your robot has inertia and it will take time to accelerate to 1m/s, so you would not expect it to travel 1m. That highlights one of the issues with a purely feed-forward odometry.

as I mentioned before, your robot really should have additional forms of feedback if position control is important to you. Most commonly used on wheeled robots like this are wheel encoders, which tell you how much the wheel spins. Rotation*radius = distanance. That will give a more accurate ...(more)

shonigmann gravatar image shonigmann  ( 2021-04-26 13:34:57 -0500 )edit