Page 1 of 1

How to send a constant thrust to Crazyflie?

Posted: Tue Jul 08, 2014 3:09 am
by trucnguyen
I am using android application and try to modify the source code.
As I understand this code line is used to send commands to Crazyflie:
mCrazyradioLink.send(new CommanderPacket(mController.getRoll(), mController.getPitch(), mController.getYaw(), (char) (mController.getThrust()/100 * MAX_THRUST), mControls.isXmode()));

To test this code line, I change value for roll, pitch and yaw to 0:
mCrazyradioLink.send(new CommanderPacket(0, 0, 0, (char) (mController.getThrust()/100 * MAX_THRUST), mControls.isXmode()));

Everything works as expected, just thrust works when I use joysticks on android.

Then I change thrust variable to constance (50), I expect that after connecting, the Crazyflie should fly up. But nothing happens.!!

mCrazyradioLink.send(new CommanderPacket(0, 0, 0, (char) (50/100 * MAX_THRUST), mControls.isXmode()));
Could you plz tell me the reason?

Re: How to send a constant thrust to Crazyflie?

Posted: Tue Jul 08, 2014 7:09 am
by trucnguyen
I know the reason, because 50/100 is always equal 0. After casting float type, the quad-copter fly.
Thanks God! :D

Re: How to send a constant thrust to Crazyflie?

Posted: Tue Jul 08, 2014 10:11 am
by tobias
Cool, you fixed it yourself. Any more problems just make a post.

Re: How to send a constant thrust to Crazyflie?

Posted: Thu Jul 05, 2018 8:46 pm
by Amir_94
Can you share your code pls?