Interbotix / interbotix_ros_arms

ROS packages for the InterbotiX X-series family of robotic arms and turrets
BSD 2-Clause "Simplified" License
49 stars 27 forks source link

Gazebo & RVIZ != love #16

Closed Ktysai closed 4 years ago

Ktysai commented 4 years ago

Hi there,

I've began again to play with ROS and I want to implement something with PX100.

I've put on top of it a Pixy camera for image recognition, but it seems I'm putting at risk the robot and the camera with some risky moves.

So... I wanted to make the code tested in Gazebo and to have Rviz to show the camera vision. I've modified the urdf & gazebo files.

Gazebo & RVIZ does work separate, but if I start Gazebo and then Rviz, it's a problem. Rviz will show incorrectly the robot position, the camera is black, but most important is presenting issues at Robot model, just like it's a TF problem.

Any suggestions?

Stay Strong! Ktysai

swinterbotix commented 4 years ago

Hi @Ktysai,

Did you make sure to unpause Gazebo's physics engine? By default, I've configured Gazebo to start in a paused state to give time for the ROS controllers to kick in. As a result, Gazebo will not start publishing to /tf or the /joint_states topics until it's unpaused. To do that, you should type rosservice call /gazebo/unpause_physics in a terminal.

So to get Gazebo and Rviz to play nice, you would do... roslaunch interbotix_gazebo gazebo.launch robot_name:=px100 use_default_rviz:=true

Then open another terminal and type... rosservice call /gazebo/unpause_physics

Note that currently, the only way to interface with the arm joints in Gazebo is to create an Action Client that sends FollowJointTrajectory messages as described here or publish trajectory messages to the arm_controller/command topic. At some point, I would like to create a node that exposes the joint/commands and single_joint/command topics to the user (just like by the real robot), processes the data, and then publishes commands directly to the right ROS Control topics in Gazebo (of course, I would need to add effort_controllers/JointPositionControllers and/or effort_controllers/JointVelocityControllers to do this).

Hope that helps!

Ktysai commented 4 years ago

@swinterbotix

Thanks for the elaborate answer! I've used the used the unpaused command rather random I might say.

Let me test it bit by bit. It's great opportunity to learn.

Stay Strong! Ktysai

Ktysai commented 4 years ago

@swinterbotix please intervene if something is not correct!

For other having an Interbotix arm and wants to play :)

Short tutorial on how to have in RVIZ a camera vision, when the simulation runs in GAZEBO. This case is for robot arm PX100

  1. cd ~/interbotix_ws/src/interbotix_ros_arms/interbotix_descriptions/urdf
  2. Make a copy of the file px100.urdf.xacro
  3. With your preferate editor editor add

`

<joint name="camera_joint" type="fixed">
  <axis xyz="0 1 0" />
  <origin xyz="0 0 0.070" rpy="0 0 0"/> <!-- Ktysai camera coordinates -->
  <parent link="$(arg robot_name)/gripper_bar_link"/>
  <child link="$(arg robot_name)/camera_link"/>
  <!-- in order to properly show the image in RVIZ the link must have the "arg" element -->
</joint>

<!-- Camera -->
<link name="$(arg robot_name)/camera_link">
  <collision>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <geometry>
  <box size="${camera_link} ${camera_link} ${camera_link}"/>
    </geometry>
  </collision>

  <visual>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <geometry>
  <box size="${camera_link} ${camera_link} ${camera_link}"/>
    </geometry>
    <material name="red"/>
  </visual>

  <inertial>
    <mass value="1e-5" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
  </inertial>
</link>

<!-- Ktysai camera addon END -->`
  1. Afterwards go to and make a backup copy and open the file a /home/vio/interbotix_ws/src/interbotix_ros_arms/interbotix_gazebo/config/interbotix_texture.gazebo
Ktysai commented 4 years ago
  1. `

    30.0 1.3962634 640 400 R8G8B8 0.02 300 gaussian 0.0 0.007 true 0.0 camera1 image_raw camera_info camera_link 0.07 0.0 0.0 0.0 0.0 0.0 `
  2. cd ~/interbotix_ws source devel/setup.bash
  3. The commands @swinterbotix recommends So to get Gazebo and Rviz to play nice, you would do... roslaunch interbotix_gazebo gazebo.launch robot_name:=px100 use_default_rviz:=true

Then open another terminal and type... rosservice call /gazebo/unpause_physics

The point "5." I'm not sure why it's so bad formatted.

Hope it helps others image

swinterbotix commented 4 years ago

Awesome! Looks good to me.

swinterbotix commented 4 years ago

Closing since issue was resolved. Feel free to reopen if you have other questions!