roboclaw icon indicating copy to clipboard operation
roboclaw copied to clipboard

Fixing odom on multiple board

Open alduxvm opened this issue 5 years ago • 0 comments

Hi,

My robot setup uses 2 roboclaws on 4 wheels, I could not make it work as explained on the readme (using packet serial mode), that did not worked for me, the roboclaws never moved...

But what it did worked, is that I created two launch files based on the https://github.com/csvance/roboclaw/blob/master/launch/roboclaw_single.launch modifying the ports according to the ports in my computer, also both my roboclaws are using the same ID 0x80 and both connected to a usb bus, and I can address each, then I created a copy from the diffdrive.launch that looks like this:

    <include file="/home/kingbee/robo_csvance/src/roboclaw/launch/roboclaw_front.launch"/> 
    <include file="/home/kingbee/robo_csvance/src/roboclaw/launch/roboclaw_rear.launch"/>    

    <node pkg="roboclaw" type="diffdrive_node" name="diffdrive" output="screen">
        <param name="~roboclaws" value="1"/>
        <param name="~steps_per_meter" value="12511"/>
        <param name="~base_width" value="0.4"/>
        <param name="~swap_motors" value="false"/>
        <param name="~invert_motor_1" value="false"/>
        <param name="~invert_motor_2" value="false"/>
        <param name="~var_pos_x" value="0.01"/>
        <param name="~var_pos_y" value="0.01"/>
        <param name="~var_theta_z" value="0.01"/>
    </node>
</launch>

And that works! both move properly!

My only issue is the odom which is messed up (I think is because is reading both encoders at the same time, instead of just reading one...) and for some reason the pos x and y keeps growing and growing!

This is an example of my robot (not moving):

---
header: 
  seq: 966
  stamp: 
    secs: 1601845581
    nsecs: 316441247
  frame_id: "odom"
child_frame_id: "base_link"
pose: 
  pose: 
    position: 
      x: 2.03120217595
      y: 1.42682195943
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: -0.160757332259
      w: 0.986993961544
  covariance: [0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01]
twist: 
  twist: 
    linear: 
      x: 0.0606266182892
      y: -6.05733339287e-05
      z: 0.0
    angular: 
      x: 0.0
      y: 0.0
      z: -0.321916713292
  covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---

I can see that pose y and x keeps growing and growing even if the wheels are not moving...

I know that this error is for sure due to the way I'm using both roboclaws, but do you have any idea?

thanks a lot!

alduxvm avatar Oct 04 '20 21:10 alduxvm