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

Namespacing hardware_interface/PositionJointInterface for multiple robots in Gazebo

asked 2020-08-05 03:25:06 -0600

Tahir M. gravatar image

updated 2020-08-05 03:37:09 -0600

I am trying to simulate three Universal Robot arms in Gazebo. I am using the official repo. I was able to spawn all the robots in Gazebo but the only the last robot(linked in the URDF) actually can move. After digging out for the problem, I noticed hardware_interface/PositionJointInterface is not namespaced properly. So that is the reason only the robot which is linked at the end can move. I verified by changing the position of relvant joints in the URDF.

To create the issue following steps can be followed:

mkdir -p test_ws/src && cd test_ws/src 

git clone https://github.com/ros-industrial/universal_robot/

catkin_create_pkg test_urdf

# Extract test_urdf.zip(attached to this post) to test_urdf package just created. 

cd ..

catkin_make

source devel/setup.bash

roslaunch test_urdf ur_gazebo.launch

# In another terminal 

rosrun rqt_joint_trajectory_controller rqt_joint_trajectory_controller

test_urdf.zip

Currently after executing the above mentioned launch file a gazebo world with three arms will be simulated. Now only left arm can be moved as it is linked at the the end in test_urdf/urdf/test.urdf.xacro. If another arm is taken to the last in the same URDF than that can be moved only.

The problem actually lies in defining the respective hardware_interface/PositionJointInterface which currently is the same for everyone. As can be seen in test_urdf/urdf/arms/ right, center or left arm.

Is there any way that hardware_interface/PositionJointInterface can be taken into namespaces respectively in xacro files?

edit retag flag offensive close merge delete

Comments

@gvdhoorn can you please say something for this issue?

Tahir M. gravatar image Tahir M.  ( 2020-08-05 04:46:06 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-06-02 01:48:34 -0600

Tuebel gravatar image

You can use the <robotNamespace> tag for the ros_control plugin in the .xacro (also have a look at the Gazebo Tutorial). The UR description loads the plugin in the common.gazebo.xacro file.

<gazebo>
  <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/MYROBOT</robotNamespace>
  </plugin>
</gazebo>

Your controllers also need to account for the namespace afterwards. If found that using namespaces in the launch files using ns= is a simple way to add the namespace. For the UR you will probably have to change it in the controller_utils.launch of the ur_gazebo package:

<rosparam file="$(find ur_gazebo)/controller/joint_state_controller.yaml" command="load" ns="/MYROBOT" />
<node name="joint_state_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn joint_state_controller" respawn="false" output="screen" ns="/MYROBOT"/>

For multiple robots I'd suggest using arg instead of the hardcoded /MYROBOT.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-08-05 03:25:06 -0600

Seen: 472 times

Last updated: Jun 02 '21