Page 1 of 1

Accessing the commander port values

Posted: Wed Nov 07, 2018 12:48 pm
by SqareOfOne
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.

Re: Accessing the commander port values

Posted: Thu Nov 08, 2018 6:34 am
by arnaud
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.

Re: Accessing the commander port values

Posted: Thu Nov 08, 2018 10:41 am
by SqareOfOne
Hi Arnaud.
Thanks that is exactly what we were looking for :D
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

Posted: Fri Nov 09, 2018 7:02 am
by arnaud
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.

Re: Accessing the commander port values

Posted: Wed Nov 14, 2018 2:22 pm
by SqareOfOne
Thank you very much. We solved it by replacing most of CommanderRpytDecodeSetpoint with a simpler version :)