Closed NarimaanV closed 7 years ago
Please, review the code in the fork: https://github.com/al3Co/BebopDrone The codes: z_MoveBy.py z_MoveSpeed.by
So once a single call of self.update(movePCMDCmd(True, 0, speed, 0, 0))
is made, the drone would keep moving forward until a call to self.update(movePCMDCmd(True, 0, 0, 0, 0))
is made? The update function would NOT return to hovering by itself?
In the self.update(movePCMDCmd(True,0,0,0,0))
the boolean data is for hovering, you can move the drone by yaw movements and keep the hovering by giving it on false, when you change this data to true the drone looses the "hovering" property, to move the drone to one or more directions (forward-backward-left-right) you need the "true" data on it. If you are only moving the drone on Yaw, you can leave on "false" or if you need just float (hover), use: self.update(movePCMDCmd(False,0,0,0,0))
command.
I see, that makes sense. Thanks for your help!
@al3Co Hi, when I read your answer I felt the need to ask you about the issue I'm having with the "hover" function. I'm trying to implement a flight plan and I want the drone to hover in it's place after flying to certain altitude, so here is the code I wrote for hovering: robot.takeoff() robot.flyToAltitude( 2.0 ) for i in xrange(100): robot.hover() robot.land() where the hover() function contains the following update : self.update( cmd=movePCMDCmd( active=True, roll=0, pitch=0, yaw=0, gaz=0 ) ) but the drone tends to drift and moves around rather that hovering in its place. Then I understood from your answer that I should write it as self.update( cmd=movePCMDCmd( active=True, roll=0, pitch=0, yaw=0, gaz=0 ) ) for once and then change the flag to false in the loop as: for i in xrange(100): self.update( cmd=movePCMDCmd( active=False, roll=0, pitch=0, yaw=0, gaz=0 ) ) I'm I correct?
Correct!
Please review: https://github.com/al3Co/BebopDrone/blob/master/core/bebop.py line: 195
def hover( self ):
self.update( cmd=movePCMDCmd( active=False, roll=0, pitch=0, yaw=0, gaz=0 ) ) #Modified
@al3Co Thank you so much! I tried the code today and the hover functionality was much more stable than before.
I am glad to read that.
Hi, This isn't an issue as it is a coding question in implementing this repository (fantastic repository by the way) for a school project. The project is basically that we have to turn our laptops into remote controls for a bebop drone. I've managed taking off and landing, now I'm left with the basic movements. During the press of a key, the drone has to move in a direction then stop when the key is lifted. My question is, is the following added in bebop.py enough to accomplish that? (based loosely on the flyToAltitude function):
I have the system setup to take single character inputs and to call that function if a certain key is pressed or keep calling that function as long as the key is held down. The only thing I'm not sure of is, will the drone stop moving once I let go or do I need to add "self.update(movePCMDCmd(True, 0, 0, 0, 0))" to the end of that function so that after every call it tries returning to hovering? Appreciate any help!