Project

General

Profile

Control API functions description » History » Version 4

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

1 1 Kévin Desormeaux
h1. Control API functions description
2
3 4 Kévin Desormeaux
h2. Using your own laptop
4
5
You shouldn't use your own laptop to run CM2C as it requires a real-time kernel (which the computers kukarm and truyere have) and you will only operate 1 arm.
6
But for information i will let this documentation here.
7
8
First you will need a real-time kernel to be able to communicate with the pandas (PREEMPT_RT). 
9
10
The procedure is described here: https://frankaemika.github.io/docs/installation_linux.html
11
More informations in french can be found here: https://bidouilledebian.wordpress.com/2018/05/31/compiler-son-noyau/
12
The second link might actually be better. 
13
14
Note: avoid the use of the fakeroot command if you have errors. 
15
16
You will also need to configure the network (ethernet). 
17
18
- In the ipv4 tab, choose manual configuration. 
19
- Adress = 172.17.1.1
20
- Mask = 255.255.255.0
21
22
That's all. 
23
24
You can ping the robot's IP to see if you are able to communicate with it.
25
- Panda1 = 172.17.1.2
26
- Panda2 = 172.17.1.3
27
28 1 Kévin Desormeaux
h2. Launching the controllers
29
30
This is done by simply using a launch file once the ROS environment is set. 
31
These launch files are located in the launch directory of the CM2C package. 
32 2 Kévin Desormeaux
They will run an admittance_joint_trajectory_controller node.
33 1 Kévin Desormeaux
34
So if kukarm is operating panda_1 run:
35 2 Kévin Desormeaux
<pre>
36 1 Kévin Desormeaux
roslaunch admittance_joint_trajectory_controller panda_1.launch
37 2 Kévin Desormeaux
</pre>
38 1 Kévin Desormeaux
and this on truyere:
39 2 Kévin Desormeaux
<pre>
40 1 Kévin Desormeaux
roslaunch admittance_joint_trajectory_controller panda_2.launch
41
</pre>
42
43
*
44
Important:* These launch files are not identical, and the panda_1.launch must be launched before the panda_2.launch. 
45
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.
46
47
h2. Utilities and control API outside of the Cooperative Manipulation scope
48 2 Kévin Desormeaux
49
*Note:* It is to be noted that functionalities presented below have been mainly developed during the pro-act project for debugging purpose etc. 
50
At the moment i cannot guarantee that this code is still working.
51
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.
52
53
h3. CM2C_API
54
55
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.
56
One is the cm2c_api node.
57
58
Once the admittance_joint_trajectory_controller node is running, you can launch the cm2c_api node in another terminal:
59
60
<pre>
61
rosrun admittance_joint_trajectory_controller cm2c_api
62
</pre>
63
64
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:
65
66
<pre>
67
rosaction call /admittance_joint_trajectory_controller/MoveJoints "{joint_names: [panda_joint6], joint_values: [0.2], duration: 5.0, abs: false}" 
68
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}" 
69
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}"
70
</pre> 
71
72
h3. Replaying a trajectory learnt by hand
73
74
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. 
75
76
h4. Quickly learn a task by hand
77
78
- Access the robot server interface: https://172.17.1.2/desk/ or https://172.17.1.3/desk/
79
- Create a new task.
80
- Add an app to the task (joint or cartesian motion)
81
- Open the app (click on it).
82
- Be sure that the led indicator of the arm is white, indicating that the robot can be moved by hand.
83
- 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
84
85
h4. Replay a trajectory learnt by hand with ROS
86 3 Kévin Desormeaux
87
The way-points recorded are saved in a .task file. We want to parse this file, and replay the trajectory by using ROS. 
88
For interpolating the way-points i used softMotion, a library for trajectory generation that is developed at LAAS.
89
We can use again the cm2c_api node to achieve that. Here are some examples of actions and services:
90
91
<pre>
92
rosrun admittance_joint_trajectory_controller cm2c_api
93
rosservice call /admittance_joint_trajectory_controller/SetSpeedLimits "speed: 0.15"
94
rosservice call /admittance_joint_trajectory_controller/SetAccLimits "speed: 0.35"
95
rosservice call /admittance_joint_trajectory_controller/SetJerkLimits "speed: 0.25"
96
rosaction call /admittance_joint_trajectory_controller/SmTrajGen "/home/kdesorme/panda_tasks/slidingDemo.task"
97
</pre>
98
99
*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.