Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added return home and roll commands #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Bybop_Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,23 @@ def emergency(self):
An emergency request shuts down the motors.
"""
self.send_data('ardrone3.Piloting.Emergency')
def roll(self,roll_value):
"""
Have the drone move left or right depending on the roll_value.
Refer to here for more information: https://github.com/Parrot-Developers/arsdk-xml/blob/e73425074471c58561d04c85da4a6400b638779d/xml/ardrone3.xml#L66
NOTE: No acknowledgement is returned.
"""
if((roll_value >100) or (roll_value < -100)):
print("Drone Roll value must be between -100 and 100")
return
self.send_data('ardrone3.Piloting.PCMD',(0,roll_value,0,0,0,0))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated in the documentation, you'll have to se the flag (1st argument) to 1 when setting a non-zero roll (or pitch) value.

Another problem is that the drone expects the PCMD to be periodic, and will revert to a "zero" (hovering) command if no PCMD is recieved in the last 500ms (in current firmwares). That's why we have an internal send loop in libARController for this command (and other periodic commands)

All in all, developing a proper drone.set_pcmd(...) command would require more work.

def retHome(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistant with the rest of the project, the function should be named return_home

"""
Send a return hoome command to the drone
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

https://github.com/Parrot-Developers/arsdk-xml/blob/e73425074471c58561d04c85da4a6400b638779d/xml/ardrone3.xml#L143
Sending 1 will send it home
"""
self.send_data('ardrone3.Piloting.NavigateHome',1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should propagate the return value of send_data to the caller (as it is done in the JumpingSumo.change_posture() function. I will add the same returns to other functions in the BebopDrone class


class JumpingSumo(Device):
def __init__(self, ip, c2d_port, d2c_port):
Expand Down