A mini-project to better explain pub-sub architecture in ROS.
cd /home/workspace/
mkdir -p /home/workspace/catkin_ws/src/
cd catkin_ws/src/
catkin_init_workspace
cd ..
cd /home/workspace/catkin_ws/src/
git clone https://github.com/udacity/RoboND-simple_arm.git simple_arm
cd /home/workspace/catkin_ws/
catkin_make
cd /home/workspace/catkin_ws/
source devel/setup.bash
rosdep install -i simple_arm
roslaunch simple_arm robot_spawn.launch
Open a new terminal and type the following:
cd /home/workspace/catkin_ws/
source devel/setup.bash
rosservice call /arm_mover/safe_move "joint_1: 0.0 joint_2: 0.0"
When trying to move the arm using the following command (line break required!),
rosservice call /arm_mover/safe_move "joint_1: 1.57
joint_2: 2.0"
the ROS server will report an error:
[ WARN] [1590169890.483779630, 524.840000000]: j2 is out of bounds, valid range (0.00,1.57), clamping to: 1.57
We can update the joint limits by reaching out to the parameter server …
rosparam set /arm_mover/max_joint_2_angle 2.0
… after which the rosservice
call above will succeed as intended.
Camera image stream is published to the following topic:
/rgb_camera/image_raw
This stream can be viewed by following command in separate terminal:
rosrun image_view image_view image:=/rgb_camera/image_raw
Originally, the code produced the following output:
[ERROR] [1590091780.648877316, 261.772000000]: GazeboRosControlPlugin missing <legacyModeNS> while using DefaultRobotHWSim, defaults to true.
This setting assumes you have an old package with an old implementation of DefaultRobotHWSim, where the robotNamespace is disregarded and absolute paths are used instead.
If you do not want to fix this issue in an old package just set <legacyModeNS> to true.
Following the answers to this question, we can find the file that needs changes by running
grep robotSimType -R .
This gives
./src/simple_arm/urdf/simple_arm.gazebo.xacro
Changing the section
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/simple_arm</robotNamespace>
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
</plugin>
</gazebo>
to contain <legacyModeNS>true</legacyModeNS>
like so suppresses the error:
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<legacyModeNS>true</legacyModeNS>
<robotNamespace>/simple_arm</robotNamespace>
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
</plugin>
</gazebo>