I'm developing a gazebo robot and I have an upper torso (upper_body_link) that needs tilting (with revolute joint 'upper_body_joint').
the problem is that when running the launch file in the gazebo with nothing else in parallel, the upper_body starts to levitate as can be seen in the images below.
I really don't understand what's happend, but it's the upper that goes up and no the lower that goes down.
In attached i send the urdf file for the robot, the ros2_control files
URDF FILE:
<xacro:include filename="inertial_macros.xacro"/> <xacro:include filename="ros2_control.xacro"/> <material name="white"> <color rgba="1 1 1 1"/> </material> <material name="blue"> <color rgba="0.2 0.2 1 1"/> </material> <material name="black"> <color rgba="0 0 0 1"/> </material> <material name="red"> <color rgba="1 0 0 1"/> </material> <material name="grey"> <color rgba="0.5 0.5 0.5 1"/> </material> <!--BASE LINK--> <link name="base_link"> </link> <!--BASE FOOTPRINT LINK--> <joint name="base_footprint_joint" type="fixed"> <parent link="base_link"/> <child link="base_footprint"/> <origin xyz="0 0 0" rpy="0 0 0"/> </joint> <link name="base_footprint"> </link> <!--CHASSI--> <joint name="chassi_joint" type="fixed"> <parent link="base_link"/> <child link="chassi_link"/> <origin xyz="0 0 0"/> <!--VIRADO PARA X--> <!--<origin xyz="0 0 0" rpy="0 0 ${pi/2}"/> VIRADO PARA Y--> </joint> <link name="chassi_link"> <visual> <origin xyz="0 0 0.085"/> <geometry> <cylinder radius="0.275" length="0.334"/> </geometry> <material name="white"/> </visual> <collision> <origin xyz="0 0 0.085"/> <geometry> <cylinder radius="0.275" length="0.17"/> </geometry> </collision> <xacro:inertial_cylinder mass="1.0" length="0.17" radius="0.275"> <origin xyz="0 0 0.085" rpy="0 0 0"/> </xacro:inertial_cylinder> </link> <gazebo reference="chassi_link"> <material>Gazebo/White</material> </gazebo> <!--LOWER BODY--> <joint name="lower_body_joint" type="prismatic"> <parent link="base_link"/> <child link="lower_body_link"/> <origin xyz="0 0 0.25" rpy="0 0 0"/> <axis xyz="0 0 1"/> <limit lower="0" upper="0.14" velocity="100" effort="100"/> </joint> <link name="lower_body_link"> <visual> <origin xyz="0 0 0.18" rpy="0 0 ${pi/2}"/> <geometry> <box size="0.2 0.05 0.35"/> </geometry> <material name="white"/> </visual> <collision> <origin xyz="0 0 0.18" rpy="0 0 ${pi/2}"/> <geometry> <box size="0.2 0.05 0.35"/> </geometry> </collision> <xacro:inertial_box mass="0.1" x="0.2" y="0.05" z="0.35"> <origin xyz="0 0 0.18" rpy="0 0 0"/> </xacro:inertial_box> </link> <gazebo reference="lower_body_link"> <material>Gazebo/White</material> <turnGravityOff>true</turnGravityOff> </gazebo> <!--UPPER BODY--> <joint name="upper_body_joint" type="revolute"> <parent link="lower_body_link"/> <child link="upper_body_link"/> <origin xyz="0 0 0.355" rpy="0 0 0"/> <axis xyz="0 1 0"/> <limit lower="0.1745" upper="1.2217" velocity="100" effort="100"/> </joint> <link name="upper_body_link"> <visual> <origin xyz="0 0 0.25" rpy="0 0 ${pi/2}"/> <geometry> <box size="0.2 0.05 0.50"/> </geometry> <material name="white"/> </visual> <collision> <origin xyz="0 0 0.25" rpy="0 0 ${pi/2}"/> <geometry> <box size="0.2 0.05 0.50"/> </geometry> </collision> <xacro:inertial_box mass="0.03" x="0.2" y="0.05" z="0.50"> <origin xyz="0 0 0.25" rpy="0 0 0"/> </xacro:inertial_box> </link> <gazebo reference="upper_body_link"> <material>Gazebo/White</material> <turnGravityOff>true</turnGravityOff> </gazebo> <xacro:ros2_control_gazebo/> ROS2_CONTROL:
<xacro:macro name="ros2_control_gazebo" params=""> <ros2_control name="GazeboSystem" type="system"> <hardware> <plugin>gazebo_ros2_control/GazeboSystem</plugin> </hardware> <!--CAMERA--> <joint name="camera_joint_y"> <command_interface name="position"> <param name="min">-0.548</param> <param name="max">0.548</param> </command_interface> <state_interface name="position"/> <state_interface name="velocity"/> <state_interface name="effort"/> </joint> <joint name="camera_joint_z"> <command_interface name="position"> <param name="min">-0.548</param> <param name="max">0.548</param> </command_interface> <state_interface name="position"/> <state_interface name="velocity"/> <state_interface name="effort"/> </joint> <!--BODY--> <joint name="upper_body_joint"> <command_interface name="position"> <param name="min">0.1745</param> <param name="max">1.2217</param> </command_interface> <state_interface name="position"/> <state_interface name="velocity"/> <state_interface name="effort"/> </joint> <joint name="lower_body_joint"> <command_interface name="position"> <param name="min">0</param> <param name="max">0.14</param> </command_interface> <state_interface name="position"/> <state_interface name="velocity"/> <state_interface name="effort"/> </joint> </ros2_control> </xacro:macro> <gazebo> <plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so"> <parameters>$(find charmie_bot)/config/controller_configuration.yaml</parameters> </plugin> </gazebo> CONTROLLERS.YAML:
controller_manager: ros__parameters: update_rate: 100
joint_trajectory_controller: type: joint_trajectory_controller/JointTrajectoryController joint_state_broadcaster: type: joint_state_broadcaster/JointStateBroadcaster joint_trajectory_controller: ros__parameters: joints: - camera_joint_y - camera_joint_z - upper_body_joint - lower_body_joint interface_name: position command_interfaces: - position state_interfaces: - position - velocity
Do you guys have any idea how to resolve this bug?
Thanks for the assist.


