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?

Attachments

Last edited by flavia1394 on Fri Jul 06, 2018 4:11 pm, edited 1 time in total.

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.

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??

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.

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.