Basic firmware: Just inputs and outputs

Firmware/software/electronics/mechanics
Post Reply
aharmsen
Beginner
Posts: 6
Joined: Thu Aug 15, 2013 7:28 pm

Basic firmware: Just inputs and outputs

Post by aharmsen »

Hello, I'm quite new to the community but am very interested in writing some code!

My plan is to write software to control the entire stabilization of the Crazyflie remotely from my computer.
For this I need to be able to run a python algorithm which takes 10 inputs: accelerometer (x,y,z), MEMS gyro (x,y,z), altitude, magnetometer (x,y,z).
And 4 outputs: motor thrust level (1,2,3,4)

I am much more interested in the advanced stabilization algorithm and not so much with the firmware itself. Hopefully there are simple python libraries already available for me to implement this.
Any thoughts of how to go about accomplishing this?
Thanks!
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Basic firmware: Just inputs and outputs

Post by tobias »

Welcome to the forums aharmsen!

What you are trying to do would be very educational but might be a bit hard to accomplish. The rate stabilisation needs to run pretty fast (I would guess 100Hz ore more) with as low lag as possible so moving this to the computer side will most likely don't work. The attitude stabilisation on the other hand could run a bit slower and might be possible to move to the computer side. As it is possible for a human to act as a attitude stabilizer, by controlling the Crazyflie in rate mode, so should a computer. For that you need to put the Crazyflie in rate mode. Yet no simple way to do this then to hard-code it in the firmware. In commander.c set them all to rate:

Code: Select all

void commanderGetRPYType(RPYType* rollType, RPYType* pitchType, RPYType* yawType)
{
  *rollType  = RATE;
  *pitchType = RATE;
  *yawType   = RATE;
}
Then you need the attitude (roll, pitch, yaw) from the Crazyflie to run the control loop on and send the output (desired rate) back to the Crazyflie.
Post Reply