Project

General

Profile

Control API functions description » History » Version 3

Kévin Desormeaux, 2021-06-11 17:14

1 1 Kévin Desormeaux
h1. Control API functions description
2
3
h2. Launching the controllers
4
5
This is done by simply using a launch file once the ROS environment is set. 
6
These launch files are located in the launch directory of the CM2C package. 
7 2 Kévin Desormeaux
They will run an admittance_joint_trajectory_controller node.
8 1 Kévin Desormeaux
9
So if kukarm is operating panda_1 run:
10 2 Kévin Desormeaux
<pre>
11 1 Kévin Desormeaux
roslaunch admittance_joint_trajectory_controller panda_1.launch
12 2 Kévin Desormeaux
</pre>
13 1 Kévin Desormeaux
and this on truyere:
14 2 Kévin Desormeaux
<pre>
15 1 Kévin Desormeaux
roslaunch admittance_joint_trajectory_controller panda_2.launch
16
</pre>
17
18
*
19
Important:* These launch files are not identical, and the panda_1.launch must be launched before the panda_2.launch. 
20
Once the controllers are running there is nothing else to do regarding the control side and you can launch the planning stack and refer to the planning API.
21
22
h2. Utilities and control API outside of the Cooperative Manipulation scope
23 2 Kévin Desormeaux
24
*Note:* It is to be noted that functionalities presented below have been mainly developed during the pro-act project for debugging purpose etc. 
25
At the moment i cannot guarantee that this code is still working.
26
In case it is not functional, it shouldn't require a lot of work to debug it. Probably some naming issues etc. You can also go back to older commits.
27
28
h3. CM2C_API
29
30
Outside of the admittance_joint_trajectory_controller which is the main node of the package containing the controller, there is some utilities developed for debugging etc.
31
One is the cm2c_api node.
32
33
Once the admittance_joint_trajectory_controller node is running, you can launch the cm2c_api node in another terminal:
34
35
<pre>
36
rosrun admittance_joint_trajectory_controller cm2c_api
37
</pre>
38
39
This node simply propose some basic functionalities to move the arm, like the MoveJoints action. With this action you can move a list of joints either with absolute or relative values:
40
41
<pre>
42
rosaction call /admittance_joint_trajectory_controller/MoveJoints "{joint_names: [panda_joint6], joint_values: [0.2], duration: 5.0, abs: false}" 
43
rosaction call /admittance_joint_trajectory_controller/MoveJoints "{joint_names: [panda_joint4, panda_joint5, panda_joint6], joint_values: [0.5,-0.6, 0.8], duration: 5.0, abs: false}" 
44
rosaction call /admittance_joint_trajectory_controller/MoveJoints "{joint_names: [panda_1_joint4, panda_1_joint5, panda_1_joint6], joint_values: [-0.5,0.5, -0.5], duration: 5.0, abs: false}"
45
</pre> 
46
47
h3. Replaying a trajectory learnt by hand
48
49
It is possible to record some way-points by moving the arm by manually. Basically by pressing buttons located at the end effector it is possible to record some way-points and to replay the trajectory via the franka web interface. You can also save a file containing those way-points but it cannot be reused as it is. So i developed some functionalities to replay with ROS a trajectory learnt by hand. *Note:* This code is old and might not be working anymore. 
50
51
h4. Quickly learn a task by hand
52
53
- Access the robot server interface: https://172.17.1.2/desk/ or https://172.17.1.3/desk/
54
- Create a new task.
55
- Add an app to the task (joint or cartesian motion)
56
- Open the app (click on it).
57
- Be sure that the led indicator of the arm is white, indicating that the robot can be moved by hand.
58
- To record way points move the arm in the desired configuration, then push 2 times the enter button (the button with an "o"), and then press 1 time the save button (the one with the checkmark). Repeat as many times as needed. You can get more information on the purpose of each button by looking at the page 37 of this manual: https://redmine.laas.fr/attachments/download/2984/pandaUserHandbook.pdf
59
60
h4. Replay a trajectory learnt by hand with ROS
61 3 Kévin Desormeaux
62
The way-points recorded are saved in a .task file. We want to parse this file, and replay the trajectory by using ROS. 
63
For interpolating the way-points i used softMotion, a library for trajectory generation that is developed at LAAS.
64
We can use again the cm2c_api node to achieve that. Here are some examples of actions and services:
65
66
<pre>
67
rosrun admittance_joint_trajectory_controller cm2c_api
68
rosservice call /admittance_joint_trajectory_controller/SetSpeedLimits "speed: 0.15"
69
rosservice call /admittance_joint_trajectory_controller/SetAccLimits "speed: 0.35"
70
rosservice call /admittance_joint_trajectory_controller/SetJerkLimits "speed: 0.25"
71
rosaction call /admittance_joint_trajectory_controller/SmTrajGen "/home/kdesorme/panda_tasks/slidingDemo.task"
72
</pre>
73
74
*Note:* You might find a trajectoryParser.py file in the scripts folder. This launch a ROS python node that basically does the same thing but it is not used anymore cm2c_api propose more functionalities. I will let it here as the python code can be interesting.