-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PID controller for tests #363
Conversation
66c3977
to
97767c4
Compare
97767c4
to
ea4246d
Compare
bbfcda7
to
3c3459b
Compare
There several issues with test_mavros packages:
In my opinion all that stuff may be written more easy... |
OK I'll review this.
Well those are not issues as you say. A different lib for the controller cause it's a util and I'm expecting to move this to mavros utils instead of this just existing for test uses. The PID instances it's because I was having problems with the library links on those. If I put them inside the class it gives me a library problem, saying it's not declared, so this was the only solution I found. |
@vooon after configuring install space and build it, I can't find any lib related to |
Update: I removed pid_controller as a lib, and have this in
and moved the variables inside the class (on // Control toolbox PID controllers
static control_toolbox::Pid pid_linvel_x;
static control_toolbox::Pid pid_linvel_y;
static control_toolbox::Pid pid_linvel_z;
static control_toolbox::Pid pid_yaw_rate;
// PID values
static std::array<double, 3> linvel_pid;
static std::array<double, 3> yawrate_pid;
// Min/max bounds for the integral windup
static double yawrate_imax;
static double yawrate_imin;
static double linvel_imax;
static double linvel_imin; But then I'm getting these errors when building: [100%] Building CXX object CMakeFiles/sitl_test_node.dir/sitl_test/sitl_test_node.cpp.o
Linking CXX executable /home/nuno/AIMAV_Project/devel/lib/test_mavros/sitl_test_node
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::linvel_imin'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::pid_linvel_x'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::linvel_pid'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::pid_linvel_z'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::yawrate_pid'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::linvel_imax'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::yawrate_imin'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::yawrate_imax'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::pid_yaw_rate'
/home/nuno/AIMAV_Project/devel/lib/libsitl_test.so: undefined reference to `pidcontroller::PIDController::pid_linvel_y'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/nuno/AIMAV_Project/devel/lib/test_mavros/sitl_test_node] Error 1
make[1]: *** [CMakeFiles/sitl_test_node.dir/all] Error 2
make: *** [all] Error 2 |
…use on offboard test
eb84cc4
to
609a62c
Compare
I got a workaround by instantiating an object of class |
This implements a PID controller so it can be used on velocity control when sending velocity setpoints to the FCU when issuing a offboard control test. Now the velocity is much more smoother and doesn't overshoot cause it's effort is firstly computed on mavros side before sending to the FCU.
Also added usage to
test_setup
, previously namedtest_type
.