We are a group of electronics students trying to create our own on-board controller for the crazyflie.
By using CrazyflieDotNet we are able to send our own values to the copter using the commander port. We have found ways to access the motors and the gyro, implementing our own controller function in power_distribution_stock.c.
However we cannot figure out how to access the commander port values within the firmware.
We tried looking at CommanderRpytDecodeSetpoint in crtp_commander_rpyt.c, since it seem to create the struct we need, but can't seem to figure out how to use it.
The function seem to have existed in an old firmware verison, but i lost track of the exact forum post.
Accessing the commander port values
-
- Beginner
- Posts: 3
- Joined: Wed Nov 07, 2018 12:10 pm
Re: Accessing the commander port values
I am not entirely sure I understand your question but I guess what you are after is the stabilizer look? The commander will fill-up a setpoint structure and this structure is made available to the stabilizer loop so that the setpoint can be passed to the controller: https://github.com/bitcraze/crazyflie-f ... zer.c#L181.
-
- Beginner
- Posts: 3
- Joined: Wed Nov 07, 2018 12:10 pm
Re: Accessing the commander port values
Hi Arnaud.
Thanks that is exactly what we were looking for
By using setpoint.attitude.roll and setpoint.attitude.pitch, we get two values clean through.
Although we don't seem to get the right values through for thrust and yaw. Are these modified internally somewhere?
Thanks that is exactly what we were looking for
By using setpoint.attitude.roll and setpoint.attitude.pitch, we get two values clean through.
Although we don't seem to get the right values through for thrust and yaw. Are these modified internally somewhere?
Re: Accessing the commander port values
Depending of what packet you are sending they are decoded in different places. If you are sending an rpyt packet it is decoded and put in the structure in crtp_commander_rpyt.c. Note that for yaw at least the value will be in setpoint.attitudeRate.yaw and the thrust is between 0 an 65535.
-
- Beginner
- Posts: 3
- Joined: Wed Nov 07, 2018 12:10 pm
Re: Accessing the commander port values
Thank you very much. We solved it by replacing most of CommanderRpytDecodeSetpoint with a simpler version