Size: 10376
Comment:
|
Size: 10367
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 122: | Line 122: |
{{http://wiki.ros.org/pilz_robots/Tutorials/Move your robot with the Python API?action=AttachFile&do=get&target=start_window_edited.png}} | {{http://wiki.ros.org/pilz_robots/Tutorials/MoveRobotWithPilzCommand_planner?action=AttachFile&do=get&target=start_window_edited.png}} |
Line 132: | Line 132: |
{{http://wiki.ros.org/pilz_robots/Tutorials/Move your robot with the Python API?action=AttachFile&do=get&target=planning_request.png}} | {{http://wiki.ros.org/pilz_robots/Tutorials/MoveRobotWithPilzCommand_planner?action=AttachFile&do=get&target=planning_request.png}} |
Line 140: | Line 140: |
{{http://wiki.ros.org/pilz_robots/Tutorials/Move your robot with the Python API?action=AttachFile&do=get&target=execute_edited.png}} | {{http://wiki.ros.org/pilz_robots/Tutorials/MoveRobotWithPilzCommand_planner?action=AttachFile&do=get&target=execute_edited.png}} |
![]() |
Move your robot with the pilz_command_planner
Description: Setup your ROS with the pilz_industrial_motion packages and learn how to plan and move your robot along a path with the pilz_command_planner.Tutorial Level: BEGINNER
Next Tutorial: Program your robot with the Python API
Contents
Introduction
In the previous tutorial you learned how to model a virtual environment and to drag the robot around there.
Building on this, this tutorial describes how to control the robot with repetitive commands. We use the Pilz motion planning command_planner, which can process the commands LIN, PTP and CIRC and will be discussed in more detail below.
You will learn in this tutorial how to control the robot in RViz with the Pilz command_planner. So in the end you can move your robot around barriers like a table.
You can also control a real robot manipulator with the same procedure but we limit this tutorial to a virtual environment. In the next tutorial we will show you how to do it with a real robot.
The files of this tutorials are also available for download from GitHub/pilz_tutorials. But we recommend to create the files on your own during this tutorial.
Prerequisites
If you completed tutorial 1 then you don't have to do anything else, you just need:
Completed the first Pilz robots tutorial Model your application with PRBT or download the files from tutorial 1 GitHub/tutorial_1 including the prerequisites from tutorial 1
Setup your simulation environment
The requirement for path-planning is to tell the program where the tool center point is positioned at the robot model. To do so you have to add the tcp-joint beneath the other joints in the file. You can also find the whole xacro file at my_first_application.xacro:
<!-- Add the tcp (tutorial 2) --> <link name="prbt_tcp"/> <!-- connect the added tcp and the flange with a joint (tutorial 2)--> <joint name="prbt_fixed_joint_tcp" type="fixed"> <origin rpy="0 0 0" xyz="0 0 0.05"/> <parent link="prbt_flange"/> <child link="prbt_tcp"/> </joint>
Furthermore we want to move the table a little bit, to model an environment where the robot can move the PNOZ from one side of the table to the other. Therefore we change the y-value to zero in line 24.
<origin rpy="0 0 0" xyz="0 0 -0.03"/>
But if you have an own real environment for your robot, feel free to change the xacro file to match your specific requirements. We will also do so in one of the next tutorials, when we try to run the real robot.
Install Pilz industrial motion package
The Pilz command_planner is available in the industrial motion package. Update your package list and install the pilz_industrial_motion meta-package in a terminal:
sudo apt-get update
sudo apt install ros-kinetic-pilz-industrial-motion
This installs the pilz_extensions, pilz_msgs and pilz_trajectory_generation package, which includes the Pilz command_planner. To test the successful installation (and your ROS environment) you can run in the terminal:
roslaunch prbt_moveit_config moveit_planning_execution.launch pipeline:=command_planner
Then the robot should be seen in RViz without table and any virtual environment. If this is the case, the packages have been installed correctly. You can end the test in the terminal with Ctrl + C, RViz should close again.
Startup with pilz_industrial_motion capabilities
We use industrial motion commands PTP and LIN to move the robot on predefined paths that give fast and reproducible trajectories. Maybe you recognized the argument pipeline:=command_planner in the test command above. We have to add this to our launch file my_application.launch to use the Pilz command_planner and also include the blend capabilities (line 12 and 13):
1 <?xml version="1.0"?>
2 <launch>
3
4 <arg name="sim" default="true" />
5
6 <!-- send urdf to param server -->
7 <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find pilz_tutorial)/urdf/my_first_application.xacro'"/>
8
9 <include file="$(find prbt_moveit_config)/launch/moveit_planning_execution.launch">
10 <arg name="load_robot_description" value="false"/>
11 <arg name="sim" value="$(arg sim)"/>
12 <arg name="pipeline" value="command_planner"/>
13 <arg name="capabilities" value="pilz_trajectory_generation/MoveGroupSequenceAction pilz_trajectory_generation/MoveGroupSequenceService"/>
14 </include>
15
16 </launch>
If you start the launch file (use the command: roslaunch pilz_tutorial my_application.launch in the terminal) RViz shows the Planner Plugin "Simple Command Planner" and you can select the planner Plugin "PTP":
Of course you can use the other Plugins LIN and CIRC too, but pay attention to the following restrictions:
- With LIN you have to watch your velocity and acceleration (if it is too high, the robot won't move. In this case you can observe an error-messages in the terminal to see if it is because of too high velocity, or if it is because something else).
- The plugin CIRC you can not use in RViz because you need to define at least two points for a circle. But you could use it for example in your soon created Python script.
Move Robot using RViz MotionPlanningPlugin
If you have selected the desired plugin (LIN or PTP) drag and drop the turquoise sphere to move the robot to an approximate goal location. You can change the tool orientation by moving the red, green or blue circles around the turquoise sphere.
Furthermore reduce the velocity and acceleration in the planning tab to 0.2 (see next picture) to avoid collisions caused by unexpected movements at your real robot.
Now you can start to plan the trajectory path and after that move your robot. Press the button "Plan" in the Planning tab at the bottom left of your window and the Pilz command_planner will plan the path for the robot and show it in RViz.
Is the planned path ok with you, press "Execute" to move your robot along the planned path. As result the robot moves to that goal position still checking possible collisions with scene objects and rejecting trajectories that would result in collisions.
If you don't want to see the planned path first, you can directly press "Plan and Execute" to do both steps at once.
As an exercise move the robot just to a valid start position, so that we can read the coordinates of its position in the next steps. For example like shown in the picture.
Conclusion
In this tutorial you have learned, how to setup and control the robot with the Python API. Therefore you can now write your first own program with moving the PRBT. If you want to learn more commands or want to see what you can general do with the Python API, you should check out the NOT WORKING YET!pilz_robots_programming API documentation.