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

How to use imu plugin with ros2 control #374

Closed
luxapana opened this issue Jul 18, 2024 · 1 comment
Closed

How to use imu plugin with ros2 control #374

luxapana opened this issue Jul 18, 2024 · 1 comment

Comments

@luxapana
Copy link

luxapana commented Jul 18, 2024

Hello

I have setup ros2 control with ackerman drive which works properly and lets me control the vehicle by publishing to ros2 topics. Now I want to add an IMU sensor and following this tutorial: https://docs.nav2.org/setup_guides/odom/setup_odom.html?highlight=imu_plugin

As per the tutorial, I have added the IMU sensor as follows:

<link name="imu_link">
        <visual>
            <geometry>
                <box size="0.1 0.1 0.1" />
            </geometry>
            <material name="Cyan">
                <color rgba="0 1.0 1.0 1.0" />
            </material>
        </visual>

        <collision>
            <geometry>
                <box size="0.1 0.1 0.1" />
            </geometry>
        </collision>

        <inertial>
            <mass value=".1" />
            <inertia ixx="0.145833" ixy="0.0" ixz="0.0" iyy="0.145833" iyz="0.0" izz="0.125" />
        </inertial>
    </link>
  <joint name="imu_joint" type="fixed">
       <parent link="base_link" />
       <child link="imu_link" />
       <origin xyz="0 0 ${base_height/2}" />
   </joint>


<gazebo reference="imu_link">
       <sensor name="imu_sensor" type="imu">
           <plugin filename="libgazebo_ros_imu_sensor.so" name="imu_plugin">
               <ros>
                   <namespace>/demo</namespace>
                   <remapping>~/out:=imu</remapping>
               </ros>
               <initial_orientation_as_reference>false</initial_orientation_as_reference>
           </plugin>
           <always_on>true</always_on>
           <update_rate>100</update_rate>
           <visualize>true</visualize>
           <imu>
               <angular_velocity>
                   <x>
                       <noise type="gaussian">
                           <mean>0.0</mean>
                           <stddev>2e-4</stddev>
                           <bias_mean>0.0000075</bias_mean>
                           <bias_stddev>0.0000008</bias_stddev>
                       </noise>
                   </x>
                   <y>
                       <noise type="gaussian">
                           <mean>0.0</mean>
                           <stddev>2e-4</stddev>
                           <bias_mean>0.0000075</bias_mean>
                           <bias_stddev>0.0000008</bias_stddev>
                       </noise>
                   </y>
                   <z>
                       <noise type="gaussian">
                           <mean>0.0</mean>
                           <stddev>2e-4</stddev>
                           <bias_mean>0.0000075</bias_mean>
                           <bias_stddev>0.0000008</bias_stddev>
                       </noise>
                   </z>
               </angular_velocity>
               <linear_acceleration>
                   <x>
                       <noise type="gaussian">
                           <mean>0.0</mean>
                           <stddev>1.7e-2</stddev>
                           <bias_mean>0.1</bias_mean>
                           <bias_stddev>0.001</bias_stddev>
                       </noise>
                   </x>
                   <y>
                       <noise type="gaussian">
                           <mean>0.0</mean>
                           <stddev>1.7e-2</stddev>
                           <bias_mean>0.1</bias_mean>
                           <bias_stddev>0.001</bias_stddev>
                       </noise>
                   </y>
                   <z>
                       <noise type="gaussian">
                           <mean>0.0</mean>
                           <stddev>1.7e-2</stddev>
                           <bias_mean>0.1</bias_mean>
                           <bias_stddev>0.001</bias_stddev>
                       </noise>
                   </z>
               </linear_acceleration>
           </imu>
       </sensor>
   </gazebo>

When started however, I get the following error:

[ruby $(which ign) gazebo-2] Library [/opt/ros/humble/lib/libgazebo_ros_imu_sensor.so] does not export any plugins. The symbol [IgnitionPluginHook] is missing, or it is not externally visible.

I am wondering if above usage of the plugin is not compatible with the ros2 control package.

Thanks

@christophfroehlich
Copy link
Contributor

Solution is here

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