Project

General

Profile

Cooperation Manipulation Control » History » Version 11

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

1 1 Kévin Desormeaux
h1. Cooperation Manipulation Control
2
3 2 Kévin Desormeaux
h2. Franka_ros
4
5 1 Kévin Desormeaux
To operate the pandas it is necessary to have real-time kernels on the machines running the control stacks. It is the case with the *kukarm* and *truyere* workstation.
6 2 Kévin Desormeaux
You should have ROS (melodic version ideally) installed. You will need to also to install *franka_ros* and *libfranka* .
7 1 Kévin Desormeaux
8
<pre>
9
sudo apt-get install ros-melodic-franka-ros
10
sudo apt-get install ros-melodic-libfranka
11
</pre>
12
13 2 Kévin Desormeaux
You are strongly advised to read the franka documentation to begin with. See https://redmine.laas.fr/projects/dual_arm_exp/wiki/Franka_documentation_and_operating_the_Pandas and https://frankaemika.github.io/docs/franka_ros.html.
14
15
!ros-architecture.png!
16
17
Basically franka_ros is a collection of package integrating libfranka into ros_control. There is packages for hardware abstraction, to control the grippers, for robots description etc.
18
19 3 Kévin Desormeaux
*Important* : libfranka must have the same versions running on the workstations (kukarm, truyere etc) and on the panda controllers (FCI). Otherwise there will be compatibility issues.
20 1 Kévin Desormeaux
21
h2. CM2C
22 3 Kévin Desormeaux
23 5 Kévin Desormeaux
h3. Installation
24
25 3 Kévin Desormeaux
Once franka_ros is installed you can create a catkin workspace in your home directory to install CM2C. See http://wiki.ros.org/catkin/Tutorials/create_a_workspace.
26
CM2C is available here on the mp2_ros repository:
27
28
https://redmine.laas.fr/projects/m2p2/repository
29 4 Kévin Desormeaux
30
Then you only have to compile your catkin workspace and CM2C can be launched. 
31
You might need to install different ROS packages missing on the system. 
32
*Important* : your catkin workspace must be built in release mode! By default it might be in debug mode, and CM2C might not be able to run at the desired frequency for real time usage.
33
34
<pre>
35
catkin build -DCMAKE_BUILD_TYPE=Release
36 1 Kévin Desormeaux
</pre>
37
38
Information on how to use CM2C can be found a bit further in the wiki: https://redmine.laas.fr/projects/dual_arm_exp/wiki/Control_API_functions_description 
39 5 Kévin Desormeaux
40 6 Kévin Desormeaux
41 5 Kévin Desormeaux
h3. The code
42
43
All the important code is located in a single file: admittance_joint_trajectory_controller_impl.h. This is where you will find the admittance control law implementation etc.
44
45 6 Kévin Desormeaux
h3. CM2P Inputs
46
47
CM2C spawns follow_joint_trajectory action servers with the following names:
48
49
<pre>
50
/panda_1_controller/follow_joint_trajectory
51
/panda_2_controller/follow_joint_trajectory
52
</pre>
53
54
CM2P send the trajectories to these servers via the dual_arm_controller_api class.
55
56 7 Kévin Desormeaux
h3. Admittance parameters Inputs
57
58
Those are initialized in admittance_joint_trajectory_controller_impl.h: 
59
60
<pre>
61
// initialize admittance controller parameters
62
admittance_translational_mass_ = 10.0;
63
admittance_translational_mass_target_ = 10.0;
64
admittance_translational_damping_ = 700.
65
admittance_translational_damping_target_ = 700.0;
66
admittance_translational_spring_ = 500.0;
67
admittance_translational_spring_target_ = 500.0;
68
admittance_rotational_mass_ = 50.0;
69
admittance_rotational_mass_target_ = 50.0;
70
admittance_rotational_damping_ = 50.0;
71
admittance_rotational_damping_target_ = 70.0;
72
admittance_rotational_spring_ = 50.0;
73
admittance_rotational_spring_target_ = 70.0;
74
</pre>
75
76
as well as in a configuration file, admittance_pose_param.cfg in the cfg repository.
77
Originally it was possible to set them dynamically via a rqt_reconfigure GUI, however it was very bugged.
78
You can set them dynamically by using the Admittance_pose_param/set_parameters service. However it will update it to both arms, so you might need to create a dedicated service for each arm.
79
80
81 1 Kévin Desormeaux
h3. From admittance_joint_trajectory_controller to simple joint_trajectory_controller
82
83 6 Kévin Desormeaux
You might want to not use the admittance gains, and only run a simple joint_trajectory_controller. This can be done by commenting the admittance gains in those 3 lines and compiling after:
84
85
<pre>
86
desired_state_.position[i] = desired_state_.position[i];// - q_dc_[i];
87
desired_state_.velocity[i] = desired_state_.velocity[i];// - dq_dc_[i];
88
desired_state_.acceleration[i] = desired_state_.acceleration[i];// - ddq_dc_[i];
89
</pre>
90
91
A reason for that is that we had issues running a place() with the admittance gains. Without it works fine.
92
93
h3. External forces estimation
94
95
The admittance control law uses the external forces measurements on the end effector to compute the admittance gains for each joint.
96
97 9 Kévin Desormeaux
h4. The fusedSensorData structure
98
99 10 Kévin Desormeaux
!fused_sensor_data.png!
100
101 9 Kévin Desormeaux
I created this structure to hold all the data from the F/T sensors. This structure is declared in admittance_joint_trajectory_controller.h.
102 1 Kévin Desormeaux
103 10 Kévin Desormeaux
The function fuse() is called every cycle in the update() function to add the last data of the active sensor into the fifo and compute the average on a sliding window to remove noise. 
104 9 Kévin Desormeaux
105
<pre>
106 10 Kévin Desormeaux
  // AVERAGE COMPUTED ON THE FIFO ABOVE, HENCE WITH NOISE SUPPRESSED
107
  Eigen::Vector3d O_mean_fused_forces_k;  // FORCES ON EEF EXPRESSED IN BASE FRAME
108
  Eigen::Vector3d O_mean_fused_torques_k; // TORQUES ON EEF EXPRESSED IN BASE FRAME
109
  Eigen::Vector3d k_mean_fused_forces_k; // FORCES ON EEF EXPRESSED IN EEF FRAME
110
  Eigen::Vector3d k_mean_fused_torques_k; // TORQUES ON EEF EXPRESSED IN EEF FRAME
111 9 Kévin Desormeaux
</pre>
112
113 10 Kévin Desormeaux
These average are then used in the control law to compute the admittance gains.
114 6 Kévin Desormeaux
115
h4. Force/Torque sensors integration
116 1 Kévin Desormeaux
117
For now we use the pandas Force/Torque sensors (FTS) to estimate the forces and torques at the end effector (EEF). The pandas have FTS at the joints, so the forces at the EEF are estimates. 
118 7 Kévin Desormeaux
If the results are okay, it would be better to dispose of a real FTS placed at the EEF. Those FTS are available at LAAS, we did most of the integration but didn't finish it. 
119
You will find a wiki page with all the information regarding these FTS here: https://wiki.laas.fr/robots/Panda
120
From an hardware point of view this is done. The wires have been extended and 3d printed support have been printed to integrate it. You can find the .stl models of these supports by following the link above. 
121 6 Kévin Desormeaux
122
From a software point of view we have a C++ library developed by Matthieu, the icub-libs. See https://git.openrobots.org/projects/icub-libs.
123
I developed a ROS wrapper of this library that you can find here: https://redmine.laas.fr/projects/icub_fts_wrapper.
124
You can put the wrapper in your catkin workspace and build it along with CM2C. Obviously you will have to install the library beforehand.
125
126
You can launch the wrapper like so in a terminal:
127
128
<pre>
129
rosrun icub_fts_wrapper icub_fts_wrapper
130 1 Kévin Desormeaux
</pre>
131 6 Kévin Desormeaux
132 1 Kévin Desormeaux
The wrapper will publish on the topic "/icub_fts_wrapper/fts_data" the force/torque sensor data. *As you can see the problem here is that it was made for a single arm and need to be extended to dual arm* by having different topic names etc. A way to do this is to use a launch file with the name of the arm as an argument, and use it to initialize the topic. 
133 7 Kévin Desormeaux
134 1 Kévin Desormeaux
The work on the wrapper is mostly done but there is a bug regarding the resolution on the Y axis to correct as well as the projection of the forces from the FTS frame to the EEF frame. The translation part is trivial but the orientation part might require more efforts.
135 7 Kévin Desormeaux
136
The wrapper is almost integrated into CM2C. The data structure fusedSensorData implemented in admittance_joint_trajectory_controller.h dispose of a active_sensor variable. By default the active sensor is "Franka", hence we use the pandas sensors. But you can set it after launching CM2C via the service /admittance_joint_trajectory_controller/setFTS. As you can see here again you will need to change the services names as for now we have 1 service for both arms. So instead you will need something like this:
137
138
/panda_1_controller/setFTS
139
/panda_2_controller/setFTS
140
141
You will also need in the function update() to read FTS data on the fts_wrapper topics, so for example:
142
143
<pre>
144
"/icub_fts_wrapper_panda_1/fts_data"
145
"/icub_fts_wrapper_panda_2/fts_data"
146
</pre>
147
148 8 Kévin Desormeaux
and to update the fusedSensorData with it. In the code you can see only the data coming from franka sensors are updated. 
149 7 Kévin Desormeaux
150 1 Kévin Desormeaux
!fts_cm2c.png!
151 8 Kévin Desormeaux
152 10 Kévin Desormeaux
So it is needed here to read the data from the icub_wrapper and to add them to the fusedSensorData structure, fts_Data. Those data must be calibrated into the EEF frame. You can do that either in the wrapper or directly here in the update function but it must be done somewhere.
153 11 Kévin Desormeaux
154
*Troubleshooting* : If you have some errors when trying to run the icub_fts_wrapper node you might need to restart the computer and it should work again.