(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Move objects in RViz with the robot

Description: You will finish the pick and place application from the previous tutorial and learn how to attach objects to the robot. So in the end you have learned how to simulate your complete application in RViz with moving the PNOZes from one side to another.

Tutorial Level: BEGINNER

Introduction

In the previous tutorial you learned how to teach a sequence of positions and develop with them a robot program. You used the Python API from the package pilz_robot_programming.

Now in this tutorial we will adapt the program from the last one to be able to move simulated objects. This works with the function SoUndSo, which can attach the object to another object like the robot arm.

Furthermore we will include a gripper in the program.

As result you will be able to simulate your complete own application for tests or teach functions.

You can also control a real robot manipulator with the same procedure but we limit this tutorial to a virtual environment. You also have to control the hardware gripper. In a later tutorial we will show you how to do it with a real robot.

Prerequisites

You need to have the following prerequisites:

The files at the end of this tutorials are also available for download from GitHub/pilz_tutorial_4. But we recommend to start with the end of tutorial 3 and create the files from this tutorial on your own.

Basics and setup

Princip

The princip of the simulation is to spawn a object in the MoveIt-Planning scene. This object can be attached to different links

Edit xacro

Before we can start you have to edit the xacro file a little bit.

On the one side have to make dissappear the PNOZ from the environment, because we will spawn a new one while running the Python script. On the other side we want to insert a machine to lay the PNOZ in, because it can not been put in the air.

Therefore just download the stl-file for the machine from machine.stl into your mesh folder (/pilz_tutorial/urdf/meshes). Then in your xacro file exchange the PNOZ with the machine and match the coordinates. In fact you just have to change the following lines in your xacro as shown below:

  • Edit the machine itself:

      31   <link name="machine">
    

      33       <origin rpy="1.5708 0 0" xyz="0 -0.5 0"/>
    

      35         <mesh filename="package://pilz_tutorial/urdf/meshes/machine.stl"
    
  • Edit the joint:

      50   <joint name="machine_joint" type="fixed">
    

      52     <child link="machine"/>
    

Again you can also download and replace the whole xacro file from my_first_application.xacro.

Program application

Spawn Object in environment

Attach object to robot

Detach object from robot

Add the functions to your python script

Whole program

You can find the whole Python script here: GitHub/myFirstApplication.py, or simply copy the following lines to your script.

Fill it in!

Conclusion

TODO

Wiki: pilz_robots/Tutorials/MoveObjectsWithRobotInRViz (last edited 2018-12-17 11:06:58 by JoGruner)