I’m trying to figure the lower/upper limits of MaxPitchRollRotationSpeed, MaxRotationSpeed, MaxVerticalSpeed and others.
From this image (source unknown) I was under the impression, that at least for MaxPitchRollRotationSpeed values between 0 and 180 can be set:
but I’m not getting a clear picture. My aim is to vary the step distance of PCMD pitch/rolls, but…
- things like
assert drone(MaxPitchRollRotationSpeed(10)).wait().success()
raise an assertion, while other values (180) seem to work - I cannot see a major difference in behaviour between 90 deg/s and 180 deg/s. Shouldn’t there be one? I mean I would expect that the 180 setup produces a wider step than the other, but there seems to be no difference to me
Here is a little test app. I’m using simulator empty-world as test field.
import olympe
import os
from olympe.messages.ardrone3.Piloting import TakeOff, moveBy, Landing, PCMD
from olympe.messages.ardrone3.SpeedSettings import MaxPitchRollRotationSpeed, MaxRotationSpeed, MaxVerticalSpeed
from olympe.messages import gimbal
DRONE_IP = os.environ.get("DRONE_IP", "192.168.188.118")
class Getch:
def __init__(self):
import tty
import sys
def __call__(self):
import sys
import tty
import termios
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
def test():
getch = Getch()
drone = olympe.Drone(DRONE_IP)
drone.connect()
assert drone(MaxPitchRollRotationSpeed(45)).wait().success()
assert drone(TakeOff()).wait().success()
assert drone(gimbal.set_target(
gimbal_id=0,
control_mode="position",
yaw_frame_of_reference="none",
yaw=0.0,
pitch_frame_of_reference="absolute",
pitch=-90,
roll_frame_of_reference="none",
roll=0.0,
)).wait().success()
while True:
c = str(getch.__call__())
if c == 'q':
assert drone(Landing()).wait().success()
drone.disconnect()
break
if c == 'm':
drone(PCMD(1, 0, 1, 0, 0, 0)).wait().success()
if __name__ == "__main__":
test()
# import olympe
# import os
# import time
# from olympe.messages import camera
# DRONE_IP = os.environ.get("DRONE_IP", "192.168.42.1")
# olympe.log.update_config({"loggers": {"olympe": {"level": "INFO"}}})
# class _Getch:
# def __init__(self):
# import tty
# import sys
# def __call__(self):
# import sys
# import tty
# import termios
# fd = sys.stdin.fileno()
# old_settings = termios.tcgetattr(fd)
# try:
# tty.setraw(sys.stdin.fileno())
# ch = sys.stdin.read(1)
# finally:
# termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
# return ch
# def yuv_frame_cb(yuv_frame):
# #print(".", end="", flush=True)
# pass
# def yuv_start_cb():
# print("yuv start cb")
# def yuv_end_cb():
# print("yuv end cb")
# def yuv_flush_cb(stream):
# print("yuv flush cb")
# return True
# def set_photo_mode(drone):
# ''' Set photo mode '''
# print("set photo mode")
# assert(drone(camera.set_camera_mode(cam_id=0, value='photo')).wait().success())
# assert(drone(camera.set_photo_mode(
# cam_id=0,
# mode='single',
# format='full_frame',
# file_format='jpeg',
# burst='burst_4_over_1s',
# bracketing='preset_1ev',
# capture_interval=0
# )).wait().success())
# def set_video_mode(drone):
# ''' Set video mode '''
# print("set video mode")
# assert(drone(camera.set_camera_mode(cam_id=0, value='recording')).wait().success())
# def take_photo(drone):
# assert(drone(camera.take_photo(cam_id=0)).wait().success())
# print("photo taken")
# def test_streaming():
# getch = _Getch()
# drone = olympe.Drone(DRONE_IP)
# if drone.connect():
# drone.streaming.set_callbacks(
# raw_cb=yuv_frame_cb,
# start_cb=yuv_start_cb,
# end_cb=yuv_end_cb,
# flush_raw_cb=yuv_flush_cb,
# )
# if drone.streaming.start():
# print("streaming started")
# while True:
# c = str(getch.__call__())
# if c == 'q':
# drone.streaming.stop()
# break
# if c == 'p':
# set_photo_mode(drone)
# if c == 'v':
# set_video_mode(drone)
# if c == 't':
# take_photo(drone)
# if __name__ == "__main__":
# test_streaming()
EDIT: If not obvious: This scripts configures MaxPitchRollRotationSpeed, starts the drone, puts the gimbal down and on “m” from the keyboard it pitches 1 unit forward. ‘q’ lands and terminates