Page 1 of 1

Matlab controllers and Crazyflie ROS package

Posted: Thu Jul 05, 2018 9:04 pm
by flavia1394
HI,
I would like to use the Matlab controller that I created in these month to let fly the crazyflie. The first step was putting all the sensor value with the ROS package in Matlab, now I would like simply to send a trajectory from MATLAB to the drone and then using the controllers that I created.

Can you help me? I will be more specific:
1) where should I send the trajectory with ROS? Is the topic /crazyflie/goal useful for this?
2) I created the publishers and subscribers in a Simulink file and everything works fine because in the graphs I can see the sine wave and the other command. The image below shows the model in Simulink. My question is: how can I let the crazyflie fly? Because even though I publish the topic and it appears in the list, nothing happen to the drone. What am I missing?

Should I rewrite the controller class in the crazyflie ros package?
Schermata 2018-07-05 alle 4.57.19 PM.png

Re: Drone fly with Matlab controller

Posted: Fri Jul 06, 2018 4:01 pm
by flavia1394
Should I rewrite the controller class into the Ros crazyflie package?

Re: Matlab controllers and Crazyflie ROS package

Posted: Sat Jul 07, 2018 12:56 am
by whoenig
If your controller is a position controller (and you want to use the on-board attitude controller), you can publish your target values to the cmd_vel topic. One example of such approach is the crazyflie_controller package in the crazyflie_ros stack.
If you want to replace the complete controller, the latency will be too high to run it off-board and achieve satisfactory performance. In this case, you should re-write your controller in C and include it in the firmware. One example of such approach is controller_mellinger.c in the firmware.

Re: Matlab controllers and Crazyflie ROS package

Posted: Tue Jul 10, 2018 1:47 pm
by flavia1394
whoenig wrote:
Sat Jul 07, 2018 12:56 am
If your controller is a position controller (and you want to use the on-board attitude controller), you can publish your target values to the cmd_vel topic. One example of such approach is the crazyflie_controller package in the crazyflie_ros stack.
If you want to replace the complete controller, the latency will be too high to run it off-board and achieve satisfactory performance. In this case, you should re-write your controller in C and include it in the firmware. One example of such approach is controller_mellinger.c in the firmware.

Thank you so much for your answer, this things help me for the thesis. My controllers in MATLAB are PID, LQG and LQT.

I saw that the cmd_vel is a topic that have roll pitch and yaw rate that are angles, and only the thrust is a PWM. In my LQG and LQT controllers I have the PWM values to sent to the motors. So do you suggest to rewrite the controller class in the ros package with a new topic that receive the PWM instead of roll pitch and yaw rate??

Re: Matlab controllers and Crazyflie ROS package

Posted: Tue Jul 10, 2018 7:57 pm
by whoenig
For controllers that output PWM directly, I suggest to implement your code in C, directly in the firmware. The latency is too high and bandwidth too low to achieve good control results if the controller is running off-board.

Re: Matlab controllers and Crazyflie ROS package

Posted: Fri Jul 13, 2018 3:29 am
by flavia1394
whoenig wrote:
Tue Jul 10, 2018 7:57 pm
For controllers that output PWM directly, I suggest to implement your code in C, directly in the firmware. The latency is too high and bandwidth too low to achieve good control results if the controller is running off-board.
Thank you for your answer.