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

No odometry data available mecanum drive plugin using gazebo topic echo CLI #2711

Open
TZECHIN6 opened this issue Jan 9, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@TZECHIN6
Copy link

TZECHIN6 commented Jan 9, 2025

Environment

  • OS Version: Ubuntu 22.04.5 LTS
  • Source or binary build? Binary, Ignition Fortress
  • ROS Version: Humble
# paste log here

Description

  • Expected behavior:
    Expected to have all the topic message being echo to confirm the dataflow is ready to pipe to ROS2 env.
  • Actual behavior:
    Not all the topic is shown, and the odom topic from the mecanum drive plugin has no data at all.

Steps to reproduce

  1. The sdf file is mostly copied from the example. You can create a sdf and copy below code for testing.
  2. ign gazebo mecanum_drive_custom.sdf (depends what you have named your sdf)
  3. Start a new terminal, ign topic -e -t /odom
  4. No message being printed out

Output

Empty...

Used sdf file for testing

<?xml version="1.0" ?>
<!--
  Ignition Gazebo Mecanum drive plugin demo

  Try sending commands:

    ign topic -t "/model/vehicle_blue/cmd_vel" -m ignition.msgs.Twist -p "linear: {x: 0.5, y: 0.5}"

    ign topic -t "/model/vehicle_blue/cmd_vel" -m ignition.msgs.Twist -p "linear: {y: 0.5}, angular: {z: 0.2}"

-->
<sdf version="1.9">
  <world name="mecanum_drive">

    <physics name="1ms" type="ignored">
      <max_step_size>0.001</max_step_size>
      <real_time_factor>1.0</real_time_factor>
    </physics>
    <plugin
      filename="ignition-gazebo-physics-system"
      name="ignition::gazebo::systems::Physics">
    </plugin>
    <plugin
      filename="ignition-gazebo-user-commands-system"
      name="ignition::gazebo::systems::UserCommands">
    </plugin>
    <plugin
      filename="ignition-gazebo-scene-broadcaster-system"
      name="ignition::gazebo::systems::SceneBroadcaster">
    </plugin>
    <plugin
      filename="ignition-gazebo-sensors-system"
      name="gz::sim::systems::Sensors">
      <render_engine>ogre2</render_engine>
    </plugin>
    <plugin 
      filename="ignition-gazebo-imu-system"
      name="ignition::gazebo::systems::Imu">
    </plugin>

    <light type="directional" name="sun">
      <cast_shadows>true</cast_shadows>
      <pose>0 0 10 0 0 0</pose>
      <diffuse>1 1 1 1</diffuse>
      <specular>0.5 0.5 0.5 1</specular>
      <attenuation>
        <range>1000</range>
        <constant>0.9</constant>
        <linear>0.01</linear>
        <quadratic>0.001</quadratic>
      </attenuation>
      <direction>-0.5 0.1 -0.9</direction>
    </light>

    <model name="ground_plane">
      <static>true</static>
      <link name="link">
        <collision name="collision">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>50</mu>
              </ode>
            </friction>
          </surface>
        </collision>
        <visual name="visual">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
          <material>
            <ambient>0.8 0.8 0.8 1</ambient>
            <diffuse>0.8 0.8 0.8 1</diffuse>
            <specular>0.8 0.8 0.8 1</specular>
          </material>
        </visual>
      </link>
    </model>

    <model name='vehicle_blue' xmlns:ignition="http://ignitionrobotics.org/schema">
      <pose>0 0 0.325 0 0 0</pose>
      <!-- <pose>0 0 0 0 0 0</pose> -->
      
      <link name='chassis'>
        <pose>-0.151427 -0 0.175 0 -0 0</pose>
        <inertial>
          <mass>1.14395</mass>
          <inertia>
            <ixx>0.126164</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.416519</iyy>
            <iyz>0</iyz>
            <izz>0.481014</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <geometry>
            <box>
              <size>2.01142 1 0.568726</size>
            </box>
          </geometry>
          <material>
            <ambient>0.5 0.5 1.0 1</ambient>
            <diffuse>0.5 0.5 1.0 1</diffuse>
            <specular>0.0 0.0 1.0 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <box>
              <size>2.01142 1 0.568726</size>
            </box>
          </geometry>
        </collision>
      </link>

      <link name='front_left_wheel'>
        <pose>0.554283 0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
            <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <pose>0 0 0 1.5707 0 0</pose>
          <geometry>
            <mesh>
              <uri>https://fuel.gazebosim.org/1.0/OpenRobotics/models/Mecanum lift/tip/files/meshes/mecanum_wheel_left.STL</uri>
              <scale>0.006 0.006 0.006</scale>
            </mesh>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <sphere>
              <radius>0.3</radius>
            </sphere>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>1.0</mu>
                <mu2>0.0</mu2>
                <fdir1 ignition:expressed_in="chassis">1 -1 0</fdir1>
              </ode>
            </friction>
          </surface>
        </collision>
      </link>

      <link name='rear_left_wheel'>
        <pose>-0.957138 0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
            <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <pose>0 0 0 1.5707 0 0</pose>
          <geometry>
            <mesh>
              <uri>https://fuel.gazebosim.org/1.0/OpenRobotics/models/Mecanum lift/tip/files/meshes/mecanum_wheel_right.STL</uri>
              <scale>0.006 0.006 0.006</scale>
            </mesh>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <sphere>
              <radius>0.3</radius>
            </sphere>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>1.0</mu>
                <mu2>0.0</mu2>
                <fdir1 ignition:expressed_in="chassis">1 1 0</fdir1>
              </ode>
            </friction>
          </surface>
        </collision>
      </link>

      <link name='front_right_wheel'>
        <pose>0.554282 -0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
            <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <pose>0 0 0 1.5707 0 0</pose>
          <geometry>
            <mesh>
              <uri>https://fuel.gazebosim.org/1.0/OpenRobotics/models/Mecanum lift/tip/files/meshes/mecanum_wheel_right.STL</uri>
              <scale>0.006 0.006 0.006</scale>
            </mesh>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <sphere>
              <radius>0.3</radius>
            </sphere>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>1.0</mu>
                <mu2>0.0</mu2>
                <fdir1 ignition:expressed_in="chassis">1 1 0</fdir1>
              </ode>
            </friction>
          </surface>
        </collision>
      </link>

      <link name='rear_right_wheel'>
        <pose>-0.957138 -0.625029 -0.025 -1.5707 0 0</pose>
        <inertial>
          <mass>2</mass>
          <inertia>
            <ixx>0.145833</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.145833</iyy>
            <iyz>0</iyz>
            <izz>0.125</izz>
          </inertia>
        </inertial>
        <visual name='visual'>
          <pose>0 0 0 1.5707 0 0</pose>
          <geometry>
            <mesh>
              <uri>https://fuel.gazebosim.org/1.0/OpenRobotics/models/Mecanum lift/tip/files/meshes/mecanum_wheel_left.STL</uri>
              <scale>0.006 0.006 0.006</scale>
            </mesh>
          </geometry>
          <material>
            <ambient>0.2 0.2 0.2 1</ambient>
            <diffuse>0.2 0.2 0.2 1</diffuse>
            <specular>0.2 0.2 0.2 1</specular>
          </material>
        </visual>
        <collision name='collision'>
          <geometry>
            <sphere>
              <radius>0.3</radius>
            </sphere>
          </geometry>
          <surface>
            <friction>
              <ode>
                <mu>1.0</mu>
                <mu2>0.0</mu2>
                <fdir1 ignition:expressed_in="chassis">1 -1 0</fdir1>
              </ode>
            </friction>
          </surface>
        </collision>
      </link>

      <link name="base_scan">
        <pose>-0.151427 -0 0.509363 0 0 0</pose>
        <inertial>
          <mass>0.1</mass>
          <inertia>
            <ixx>0.000166667</ixx>
            <iyy>0.000166667</iyy>
            <izz>0.000166667</izz>
          </inertia>
        </inertial>
        <collision name="collision">
          <geometry>
            <box>
              <size>0.1 0.1 0.1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>0.1 0.1 0.1</size>
            </box>
          </geometry>
        </visual>
        <sensor name='gpu_lidar' type='gpu_lidar'>
          <topic>scan</topic>
          <!-- publish frame -->
          <gz_frame_id>base_scan</gz_frame_id> 
          <update_rate>10</update_rate>
          <lidar>
            <scan>
              <horizontal>
                <samples>640</samples>
                <resolution>1</resolution>
                <min_angle>0.0</min_angle>
                <max_angle>6.28</max_angle>
              </horizontal>
              <!-- <vertical>
                <samples>16</samples>
                <resolution>1</resolution>
                <min_angle>-0.261799</min_angle>
                <max_angle>0.261799</max_angle>
              </vertical> -->
            </scan>
            <range>
              <min>0.08</min>
              <max>10.0</max>
              <resolution>0.01</resolution>
            </range>
          </lidar>
          <alwaysOn>1</alwaysOn>
          <visualize>true</visualize>
        </sensor>
      </link>




      <joint name='front_left_wheel_joint' type='revolute'>
        <parent>chassis</parent>
        <child>front_left_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <joint name='front_right_wheel_joint' type='revolute'>
        <parent>chassis</parent>
        <child>front_right_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <joint name='rear_left_wheel_joint' type='revolute'>
        <parent>chassis</parent>
        <child>rear_left_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <joint name='rear_right_wheel_joint' type='revolute'>
        <parent>chassis</parent>
        <child>rear_right_wheel</child>
        <axis>
          <xyz>0 0 1</xyz>
          <limit>
            <lower>-1.79769e+308</lower>
            <upper>1.79769e+308</upper>
          </limit>
        </axis>
      </joint>

      <!-- sensor joint -->
      <joint name="lidar_joint" type="fixed">
        <parent>chassis</parent>
        <child>base_scan</child>
      </joint>

      <plugin
        filename="ignition-gazebo-mecanum-drive-system"
        name="ignition::gazebo::systems::MecanumDrive">
        <front_left_joint>front_left_wheel_joint</front_left_joint>
        <front_right_joint>front_right_wheel_joint</front_right_joint>
        <back_left_joint>rear_left_wheel_joint</back_left_joint>
        <back_right_joint>rear_right_wheel_joint</back_right_joint>
        <wheel_separation>1.25</wheel_separation>
        <wheelbase>1.511</wheelbase>
        <wheel_radius>0.3</wheel_radius>
        <min_acceleration>-5</min_acceleration>
        <max_acceleration>5</max_acceleration>
        <odom_topic>odom</odom_topic> <!-- from <odometry_topic> -->
        <frame_id>odom</frame_id> <!-- from <odometry_frame> -->
        <child_frame_id>chassis</child_frame_id> <!-- from <robot_base_frame> -->
      </plugin>

    </model>

  </world>
</sdf>
@TZECHIN6 TZECHIN6 added the bug Something isn't working label Jan 9, 2025
@azeey azeey added enhancement New feature or request and removed bug Something isn't working labels Jan 9, 2025
@azeey
Copy link
Contributor

azeey commented Jan 9, 2025

This is being implemented in #2297. Once that's merged, it might be possible to backport it.

@azeey azeey self-assigned this Jan 9, 2025
@azeey azeey moved this from Inbox to To do in Core development Jan 9, 2025
@TZECHIN6
Copy link
Author

Thanks for the reply, sorry I am very new to the new gazebo. So, by your statement, my current build has no odom and tf data available right? So even I us gz-bridge to bridge up ROS2 topic, there will be still no data at all for odom and tf.

(I have followed your turtlebot3 example, and want to create a mecanum drive robot with Nav2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

2 participants