Gazebo | Ignition | Community
Ask Your Question
0

Set Odometry in a new robot in ROS

asked 2017-02-21 10:41:07 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I'm trying to create a robot with a new model in ROS .gazebo/models. I defined model.config and model.sdf. I have to set the ros message Odometry because in the 'risotopic list' there isn't /odom.

How can I define the odometry of my robot?

this is model.sdf:

<sdf version="1.4"> <model name="arduino_robot"> <static>true</static>

    <link name='rack'>
    <inertial>
    <pose>0.001453 -0.000453 0.029787 0 0 0</pose>
    <inertia>
      <ixx>0.058640</ixx>
      <ixy>0.000124</ixy>
      <ixz>0.000615</ixz>
      <iyy>0.058786</iyy>
      <iyz>0.000014</iyz>
      <izz>1.532440</izz>
    </inertia>
    <mass>2.234000</mass>
  </inertial>


    <collision name='plate_down'>
            <pose>0 0 .05 0 0 0</pose>
          <geometry>
            <cylinder>
              <radius>0.19</radius>
              <length>.015</length>
            </cylinder>
          </geometry>
        </collision>
        <visual name='plate_down'>
          <geometry>
            <cylinder>
              <radius>.19</radius>
              <length>.015</length>
            </cylinder>
          </geometry>
        </visual>

    <collision name='plate_up'>
            <pose>0 0 .2 0 0 0</pose>
          <geometry>
            <cylinder>
              <radius>0.19</radius>
              <length>.015</length>
            </cylinder>
          </geometry>
        </collision>
        <visual name='plate_up'>
          <geometry>
            <cylinder>
              <radius>.19</radius>
              <length>.015</length>
            </cylinder>
          </geometry>
        </visual>


     <collision name="left_wheel">
    <!--<pose> y(per centrare le ruote) x(per avvicinare le ruote) z ro teta phi (angoli di rotazione)</pose>-->
    <pose>0.025 0.1 0.05 0 1.5 1.5</pose>
      <geometry>
        <cylinder>
          <radius>.05</radius>
          <length>.02</length>
        </cylinder>
      </geometry>
    </collision>
    <visual name="left_wheel">
      <geometry>
        <cylinder>
          <radius>.05</radius>
          <length>.025</length>
        </cylinder>
      </geometry>
    </visual>

  <collision name="right_wheel">
    <pose>0.025 -0.1 0.05 0 1.5 1.5</pose>
      <geometry>
        <cylinder>
          <radius>.05</radius>
          <length>.02</length>
        </cylinder>
      </geometry>
    </collision>
    <visual name="right_wheel">
      <geometry>
        <cylinder>
          <radius>.05</radius>
          <length>.025</length>
        </cylinder>
      </geometry>
    </visual>

<sensor name="laser" type="ray"> <pose>-0.065000 0 0.092000 0 0 0</pose> <ray> <scan> <horizontal> <samples>180</samples> <resolution>1.000000</resolution> <min_angle>-2.268928</min_angle> <max_angle>2.268928</max_angle> </horizontal> </scan> <range> <min>0.080000</min> <max>10</max> <resolution>0.010000</resolution> </range> </ray> <update_rate>20</update_rate> </sensor> </link> <include> <uri>model://kinect</uri> <pose>-0.087098 0 0.303857 0 0 0</pose> </include>

<joint name="create_rack" type="revolute"> <parent>create::base</parent> <child>rack</child> <axis> <xyz>0 0 1</xyz> <limit> <lower>0</lower> <upper>0</upper> </limit> </axis> </joint> <joint name="kinect_rack" type="revolute"> <parent>kinect::link</parent> <child>rack</child> <axis> <xyz>0 0 1</xyz> <limit> <lower>0</lower> <upper>0</upper> </limit> </axis> </joint>

<plugin name="Odometry" filename="libodometry.so"/>

    </model>
</sdf>
edit retag flag offensive close merge delete

Comments

does this model describe an ackerman steering arrangement for the robot? Asking as the better way is to implement in code.

PMilani gravatar imagePMilani ( 2017-02-23 17:52:02 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-02-23 17:59:25 -0600

PMilani gravatar image

updated 2017-02-23 18:03:57 -0600

Calculating the odometry is typically done via a plugin, that is a piece of code inserted into the model that can do calculations and change the model based on an interface defined here

A Model plugin will give you access to joint information usually useful for calculating your odometry. For special arrangements its usually better to calculate your odometry and publish as you see fit, typically via a ros odometry message.

Alternatively for common arrangements there are some existing plugins available that might suit your purpose. I am thinking specifically of the differential drive ros plugin, skid steer plugin and planar drive plugin. They will give you a control interface (for issuing commands) as well as output odometry information.

edit flag offensive delete link more

Comments

Thank you so much.

tiagosilvadev gravatar imagetiagosilvadev ( 2021-08-15 20:06:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-02-21 10:41:07 -0600

Seen: 3,526 times

Last updated: Feb 23 '17