whoenig / crazyflie_cpp

C++ Library to communicate with Bitcraze Crazyflie
MIT License
21 stars 38 forks source link

Pitch value in Crazyflie::sendSetpoint method #16

Closed AliGriv closed 3 years ago

AliGriv commented 3 years ago

Hello,

I had been looking into your library and comparing it with the python implementation in Cflib Repository, a nuance difference caught my eye. There is a negative sign behind pitch value here which is not the same as the cpp implementation. I was wondering what is the source of this difference? In my own application, it seemed that I should go with the negative sign (although I haven't been completely successful using crazyflie_cpp for my project). Previously, I was able to successfully use Cflib Repository to fly my drones using external motion capture system, however, I need to switch to C++ for my main project and I'm still struggling with it. I would be grateful if you can provide me some information about this function and its differences with its python counterpart.

Thank you.

whoenig commented 3 years ago

This might be just for historical reasons. It is certainly wrong in the firmware (w.r.t. to a right-handed coordinate system) and different libraries try to "fix" it at different levels. CRTP is the lowest level, so when you write your code in C++ you might just need to call the sendSetpoint() function with a negative sign on your side.

If you are interested into using a mocap, please also check out the https://crazyswarm.readthedocs.io/, which supports various mocaps and could be seen as a "reference implementation" on how to use crazyflie_cpp. While the Crazyswarm relies on ROS (and is therefore bound to Ubuntu), it is entirely possible to remove the ROS dependency.