Fly Crazy Fly! but it says, it wont listen to me

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
Cyientist
Beginner
Posts: 8
Joined: Mon Mar 16, 2015 12:12 pm

Fly Crazy Fly! but it says, it wont listen to me

Post by Cyientist »

I'm thinking of using the ramp.py example to make the crazyflie run continuously at 20000 thrust. Given below is a small excerpt off the code, I modified the original part. I'm not able to understand what's the problem. I just run the program, it flies for a second and then stops. I'm not knowing what's wrong, Will the crazyflie expect us to send the command

self._cf.commander.send_setpoint(roll, pitch, yawrate, thrust)

often in order to run motors? Basically what I want to do is, assign thrust to 20000 and make it run at that thrust until a value w is recieved, which will end the motors and reset the thrust.

Given below is the code I modified.

self._cf.commander.send_setpoint(roll, pitch, yawrate, thrust)
k=raw_input()
while k !- "w":
k = raw_input()
self._cf.commander.send_setpoint(0, 0, 0, 0)
derf
Expert
Posts: 163
Joined: Fri May 31, 2013 12:17 am
Location: Germany

Re: Fly Crazy Fly! but it says, it wont listen to me

Post by derf »

Yes, you have to continuously send a setpoint command to run the motors. If you don't send it, the motors will stop.

So you would need to move the setpoint command into your while loop.
Something along the lines of this (not tested):

Code: Select all

k=raw_input()
while k !- "w":
	self._cf.commander.send_setpoint(roll, pitch, yawrate, thrust)
	k = raw_input()
self._cf.commander.send_setpoint(0, 0, 0, 0)
Hope that helps
Cyientist
Beginner
Posts: 8
Joined: Mon Mar 16, 2015 12:12 pm

Re: Fly Crazy Fly! but it says, it wont listen to me

Post by Cyientist »

THanks for the response.

I did try that but it didn't work, I mean basically, it has run the set point line and after that it stopped and disconnected while the while loop in python is still raw input accepting values, what might be happening here is, until it receives some raw input, the while loop doesn't restart, hence if we take too much time in sending raw value, it shall eventually stop and exit the code.

, I guess may be I should be using thread to keep running the process while changing raw input in another process setting up the thrust. Or may be change the firmware of the crazyflie, use some kinda thread to make it accept values in realtime. Any such firmwares already available?

But again, there's a small problem, since I have attached the larger battery given by CF, i can't fix it with the pins given by CF guys (which hold smaller battery firmly), and now like somebody else had faced, my crazyflie drifts sidewards. Any fixes on this issue too?

May be the stock firmware itself should have an auto stabilization command that shall stabilize it at a particular height and we send a message to move it in desired direction.

Does CF work on some kind of RTOS?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Fly Crazy Fly! but it says, it wont listen to me

Post by tobias »

Does CF work on some kind of RTOS?
The Crazyflie runs FreeRTOS.
Post Reply