How to send a constant thrust to Crazyflie?

Firmware/software/electronics/mechanics
Post Reply
trucnguyen
Beginner
Posts: 2
Joined: Tue Jul 08, 2014 2:59 am

How to send a constant thrust to Crazyflie?

Post by trucnguyen » Tue Jul 08, 2014 3:09 am

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?

trucnguyen
Beginner
Posts: 2
Joined: Tue Jul 08, 2014 2:59 am

Re: How to send a constant thrust to Crazyflie?

Post by trucnguyen » Tue Jul 08, 2014 7:09 am

I know the reason, because 50/100 is always equal 0. After casting float type, the quad-copter fly.
Thanks God! :D

tobias
Bitcraze
Posts: 1693
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: How to send a constant thrust to Crazyflie?

Post by tobias » Tue Jul 08, 2014 10:11 am

Cool, you fixed it yourself. Any more problems just make a post.

Amir_94
Beginner
Posts: 2
Joined: Wed May 23, 2018 10:55 pm

Re: How to send a constant thrust to Crazyflie?

Post by Amir_94 » Thu Jul 05, 2018 8:46 pm

Can you share your code pls?

Post Reply