How to convert movements into RPY?

Firmware/software/electronics/mechanics
Post Reply
fixp
Beginner
Posts: 5
Joined: Mon Jan 12, 2015 7:21 pm

How to convert movements into RPY?

Post by fixp »

Hello everyone, I'm following the crazyflie code in order to modify it a bit to get kind of autonomous flight. What I meant is like to give instructions with an script 'go forward' 'turn 20 degrees' 'stop but keep altitude' .

Diving into the code I arrived to some part on the stabilizer.c where if the imu6 is ok you've got:

commanderGetRPY(&eulerRollDesired, &eulerPitchDesired, &eulerYawDesired);
commanderGetRPYType(&rollType, &pitchType, &yawType);

Where this values come from? Is there any way I can calculate this values regarding my movements instructions? I know how to program, just talking about math I guess.

I hope you can help me


Thank you very much

Javier (living in France but from Argentina)
CrazyGuy
Beginner
Posts: 27
Joined: Fri May 02, 2014 6:03 pm

Re: How to convert movements into RPY?

Post by CrazyGuy »

Hello,

the cf-client gets the data for example from the connected usb-controller (roll, pitch, yaw, thrust), packs them and sends this data via radio to the crazyflie (send_setpoint in client/lib/cflib/crazyflie/commander.py). There in "modules/src/commander.c" the data gets "unpacked" and saved in targetVal. After you call the function commanderGetRPY, the 3 arguments will contain the latest data send to the cf.
With commanderGetRPYType you get the additional information about roll, pitch, yaw. The regulator needs to know which unit roll, pitch and yaw have. Usually roll and pitch are given in degrees and yaw is given in degrees per second. So here rollType and pitchType should be always ANGLE and yawType = RATE (these are typedefs in modules/interface/commander.h)

For stopping in the air without moving in any direction I think you have to use cameras which track the cf.

If you don't care about the exact position:
"go forward" means: pitch has to be positiv
"turning X degrees" means: set yaw != 0 until you have your desired X degrees

for keeping altitude there is a mapped button on the controller. But you need a cf with barometer. Since I don't have a cf with barometer I don't know how well the altitude-function works

CrazyGuy
fixp
Beginner
Posts: 5
Joined: Mon Jan 12, 2015 7:21 pm

Re: How to convert movements into RPY?

Post by fixp »

Thank you very much crazy guy! what does CF stands for? crazy flie no?

But there is something I dont get.... when you said ' gets the data for example from the connected usb-controller (roll, pitch, yaw, thrust)' you mean what kind of data?? because the PS3 controller wont get you that plain data, it will give you which button you are pressing I guess so my question is how to ttranslate those buttons into yaw pitch roll thrust data?

Maybe I didnt understand your point... sorry for that

Thanks you very much
Post Reply