ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

controller_manager not publishing /joint_state topic

asked 2021-02-24 07:19:05 -0600

djangbahevans gravatar image

updated 2021-02-24 08:23:07 -0600

I am a ROS beginner so this might all be a rather basic mistake. But I have a simulation of a drone in Gazebo. I am using controller_manager to spawn controllers for the propellers and a camera. However, robot model in Rviz gives me a lot of no transform link errors because /joint_state topic is not being published.

Here is my control.yaml file

joint_state_controller:
  type: joint_state_controller/JointStateController
  publish_rate: 50

joint_motor_controller:
  type: velocity_controllers/JointGroupVelocityController
  joints:
    - front_left_prop_joint
    - front_right_prop_joint
    - back_left_prop_joint
    - back_right_prop_joint

camera_joint_position_controller:
  type: position_controllers/JointPositionController
  joint: camera_joint

drone_base.xacro

<?xml version="1.0" encoding="utf-8"?>
<robot name="drone_description"
  xmlns:xacro="http://www.ros.org/wiki/xacro">
  <xacro:property name="PI" value="3.14159265359"/>

  <xacro:include filename="$(find drone_description)/urdf/drone_macros.xacro" />
  <xacro:include filename="$(find drone_description)/urdf/drone_gazebo.xacro" />
  <xacro:include filename="$(find drone_description)/urdf/sensors.xacro" />

  <!-- DUMMY lINK -->
  <link name="dummy_link" />

  <!-- LINKS -->
  <link name="base_link">
    <inertial>
      <origin xyz="5.7334E-07 0.026879 0.015324" rpy="0 0 0" />
      <mass value="0.38016" />
      <inertia ixx="0.00029212" ixy="-1.331E-09" ixz="-3.9126E-08" iyy="0.00040699" iyz="1.6869E-06" izz="0.00015798" />
    </inertial>
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://drone_description/meshes/base_link.STL" />
      </geometry>
      <material name="">
        <color rgba="0.69804 0.69804 0.69804 1" />
      </material>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://drone_description/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>

  <link name="camera">
    <inertial>
      <origin xyz="-0.0036143 0.00349 0.00925" rpy="0 0 0" />
      <mass value="0.090718" />
      <inertia ixx="2.4903E-06" ixy="3.2829E-09" ixz="8.2525E-22" iyy="3.279E-06" iyz="-1.531E-21" izz="2.3388E-06" />
    </inertial>
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://drone_description/meshes/camera.STL" />
      </geometry>
      <material name="">
        <color rgba="0.69804 0.69804 0.69804 1" />
      </material>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://drone_description/meshes/camera.STL" />
      </geometry>
    </collision>
  </link>

  <!-- DUMMY JOINT -->
  <joint name="dummy" type="fixed">
    <parent link="dummy_link" />
    <child link="base_link" />
  </joint>

  <!-- JOINT -->
  <joint name="camera_joint" type="revolute">
    <origin xyz="0.00925 0.059965 0.0165" rpy="${PI/2} 0 -${PI/2}" />
    <parent link="base_link" />
    <child link="camera" />
    <axis xyz="0 0 1" />
    <limit lower="0" upper="${PI/3}" effort="100" velocity="1" />
  </joint>

  <transmission name="camera_trans">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="camera_joint">
      <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="camera_motor">
      <mechanicalReduction>1</mechanicalReduction>
      <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </actuator>
  </transmission>

  <xacro:prop_link name="front_left_prop" />
  <xacro:prop_link name="front_right_prop" />
  <xacro:prop_link name="back_left_prop" />
  <xacro:prop_link name="back_right_prop" />

  <xacro:prop_joint name="front_left_prop" originxyz="-0.092959 ...
(more)
edit retag flag offensive close merge delete

Comments

Can you also post the error messages? Specifically which links are missing.

turtleMaster20 gravatar image turtleMaster20  ( 2021-02-24 08:19:56 -0600 )edit

For the dummy_link and base_link, Rviz determines the transforms properly, but for all other links, it says "No transform from [{child_link}] to [base_link]".

djangbahevans gravatar image djangbahevans  ( 2021-02-24 08:29:21 -0600 )edit

I am guessing the links are not 'jointed' to the dummy link. Try this:

<joint name="dummy" type="fixed"> <parent link="base_link" /> <child link="{child_link}" /> </joint>

Note: In this example it is assumed that the [base_link] and [{child_link}] the same origin, if they have a displacement (or if the relation is not fixed) then change accordingly.

turtleMaster20 gravatar image turtleMaster20  ( 2021-02-24 08:43:09 -0600 )edit

There already are joints joining all the other links to the base_link, and they display and work fine in Gazebo. The problem is Rviz visualization isn't working because nothing is publishing on the /joint_states topic.

djangbahevans gravatar image djangbahevans  ( 2021-02-24 09:03:35 -0600 )edit
1

Any reason you are not feeding joint_state_controller argument into the the controller_spawner? Can you check once with this argument?

turtleMaster20 gravatar image turtleMaster20  ( 2021-02-24 09:59:08 -0600 )edit

That was the mistake. Thanks @turtleMaster20

djangbahevans gravatar image djangbahevans  ( 2021-02-24 14:05:11 -0600 )edit

Can you tick mark the answer I have posted? Cheers!

turtleMaster20 gravatar image turtleMaster20  ( 2021-02-25 00:53:53 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-02-25 00:53:24 -0600

joint_state_controller argument is not included when the controller_spawner is started.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-02-24 07:19:05 -0600

Seen: 650 times

Last updated: Feb 25 '21