|
13 | 13 | #include <Eigen/Eigen>
|
14 | 14 | #include <math.h>
|
15 | 15 | #include <command_to_mavros.h>
|
16 |
| -#include <pos_controller_utils.h> |
| 16 | +#include <px4_command_utils.h> |
17 | 17 | #include <math_utils.h>
|
18 | 18 | #include <LowPassFilter.h>
|
19 | 19 | #include <HighPassFilter.h>
|
@@ -166,8 +166,8 @@ Eigen::Vector3d pos_controller_passivity::pos_controller(
|
166 | 166 | Eigen::Vector3d accel_sp;
|
167 | 167 | Eigen::Vector3d thrust_sp;
|
168 | 168 | // 计算误差项
|
169 |
| - Eigen::Vector3f pos_error = pos_controller_utils::cal_pos_error(_DroneState, _Reference_State); |
170 |
| - Eigen::Vector3f vel_error = pos_controller_utils::cal_vel_error(_DroneState, _Reference_State); |
| 169 | + Eigen::Vector3f pos_error = px4_command_utils::cal_pos_error(_DroneState, _Reference_State); |
| 170 | + Eigen::Vector3f vel_error = px4_command_utils::cal_vel_error(_DroneState, _Reference_State); |
171 | 171 |
|
172 | 172 | // 误差项限幅
|
173 | 173 | for (int i=0; i<3; i++)
|
@@ -250,31 +250,6 @@ Eigen::Vector3d pos_controller_passivity::pos_controller(
|
250 | 250 | }
|
251 | 251 |
|
252 | 252 | return thrust_sp;
|
253 |
| - |
254 |
| - // cout <<">>>>>>>>>>>>>>>>>>>>>>PID Position Controller<<<<<<<<<<<<<<<<<<<<<" <<endl; |
255 |
| - |
256 |
| - // //固定的浮点显示 |
257 |
| - // cout.setf(ios::fixed); |
258 |
| - // //左对齐 |
259 |
| - // cout.setf(ios::left); |
260 |
| - // // 强制显示小数点 |
261 |
| - // cout.setf(ios::showpoint); |
262 |
| - // // 强制显示符号 |
263 |
| - // cout.setf(ios::showpos); |
264 |
| - |
265 |
| - // cout<<setprecision(2); |
266 |
| - |
267 |
| - // cout << "e_p [X Y Z] : " << pos_error[0] << " [m] "<< pos_error[1]<<" [m] "<<pos_error[2]<<" [m] "<<endl; |
268 |
| - // cout << "e_v [X Y Z] : " << vel_error[0] << " [m/s] "<< vel_error[1]<<" [m/s] "<<vel_error[2]<<" [m/s] "<<endl; |
269 |
| - // cout << "acc_ref [X Y Z] : " << _Reference_State.acceleration_ref[0] << " [m/s^2] "<< _Reference_State.acceleration_ref[1]<<" [m/s^2] "<<_Reference_State.acceleration_ref[2]<<" [m/s^2] "<<endl; |
270 |
| - |
271 |
| - // cout << "desired_acceleration [X Y Z] : " << _AttitudeReference.desired_acceleration[0] << " [m/s^2] "<< _AttitudeReference.desired_acceleration[1]<<" [Nm/s^2] "<<_AttitudeReference.desired_acceleration[2]<<" [m/s^2] "<<endl; |
272 |
| - // cout << "desired_thrust [X Y Z] : " << _AttitudeReference.desired_thrust[0] << " [N] "<< _AttitudeReference.desired_thrust[1]<<" [N] "<<_AttitudeReference.desired_thrust[2]<<" [N] "<<endl; |
273 |
| - // cout << "desired_thrust_normalized [X Y Z] : " << _AttitudeReference.desired_thrust_normalized[0] << " [N] "<< _AttitudeReference.desired_thrust_normalized[1]<<" [N] "<<_AttitudeReference.desired_thrust_normalized[2]<<" [N] "<<endl; |
274 |
| - // cout << "desired_attitude [R P Y] : " << _AttitudeReference.desired_attitude[0] * 180/M_PI <<" [deg] "<<_AttitudeReference.desired_attitude[1] * 180/M_PI << " [deg] "<< _AttitudeReference.desired_attitude[2] * 180/M_PI<<" [deg] "<<endl; |
275 |
| - // cout << "desired_throttle [0-1] : " << _AttitudeReference.desired_throttle <<endl; |
276 |
| - |
277 |
| - //return _AttitudeReference; |
278 | 253 | }
|
279 | 254 |
|
280 | 255 |
|
@@ -329,18 +304,18 @@ void pos_controller_passivity::printf_result()
|
329 | 304 |
|
330 | 305 | cout<<setprecision(2);
|
331 | 306 |
|
332 |
| - // cout << "u_l [X Y Z] : " << u_l[0] << " [N] "<< u_l[1]<<" [N] "<<u_l[2]<<" [N] "<<endl; |
333 |
| - // cout << "z_k [X Y Z] : " << z_k[0] << " [N] "<< z_k[1]<<" [N] "<<z_k[2]<<" [N] "<<endl; |
| 307 | + cout << "u_l [X Y Z] : " << u_l[0] << " [N] "<< u_l[1]<<" [N] "<<u_l[2]<<" [N] "<<endl; |
| 308 | + cout << "z_k [X Y Z] : " << z_k[0] << " [N] "<< z_k[1]<<" [N] "<<z_k[2]<<" [N] "<<endl; |
334 | 309 |
|
335 |
| - // cout << "y1 [X Y Z] : " << y1_k[0] << " [N] "<< y1_k[1]<<" [N] "<<y1_k[2]<<" [N] "<<endl; |
| 310 | + cout << "y1 [X Y Z] : " << y1_k[0] << " [N] "<< y1_k[1]<<" [N] "<<y1_k[2]<<" [N] "<<endl; |
336 | 311 |
|
337 |
| - // cout << "y2 [X Y Z] : " << y2_k[0] << " [N] "<< y2_k[1]<<" [N] "<<y2_k[2]<<" [N] "<<endl; |
| 312 | + cout << "y2 [X Y Z] : " << y2_k[0] << " [N] "<< y2_k[1]<<" [N] "<<y2_k[2]<<" [N] "<<endl; |
338 | 313 |
|
339 |
| - // cout << "y3 [X Y Z] : " << y3_k[0] << " [N] "<< y3_k[1]<<" [N] "<<y3_k[2]<<" [N] "<<endl; |
| 314 | + cout << "y3 [X Y Z] : " << y3_k[0] << " [N] "<< y3_k[1]<<" [N] "<<y3_k[2]<<" [N] "<<endl; |
340 | 315 |
|
341 |
| - // cout << "u_l [X Y Z] : " << u_l[0] << " [N] "<< u_l[1]<<" [N] "<<u_l[2]<<" [N] "<<endl; |
| 316 | + cout << "u_l [X Y Z] : " << u_l[0] << " [N] "<< u_l[1]<<" [N] "<<u_l[2]<<" [N] "<<endl; |
342 | 317 |
|
343 |
| - // cout << "u_d [X Y Z] : " << u_d[0] << " [N] "<< u_d[1]<<" [N] "<<u_d[2]<<" [N] "<<endl; |
| 318 | + cout << "u_d [X Y Z] : " << u_d[0] << " [N] "<< u_d[1]<<" [N] "<<u_d[2]<<" [N] "<<endl; |
344 | 319 |
|
345 | 320 | cout << "thrust_sp [X Y Z] : " << thrust_sp[0] << " [m/s^2] "<< thrust_sp[1]<<" [m/s^2] "<<thrust_sp[2]<<" [m/s^2] "<<endl;
|
346 | 321 |
|
|
0 commit comments