-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Gopro wifi #665
base: master
Are you sure you want to change the base?
Gopro wifi #665
Conversation
…when a waypoint is reached and the drone starts heading for the next one.
…uts from the AUV.
self._current_waypoint = m.seq | ||
if m.seq != self._current_waypoint: | ||
self._current_waypoint = m.seq | ||
self.notify_attribute_listeners('commands.next',self._current_waypoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add a space between the , self
|
||
The message definition is here: https://pixhawk.ethz.ch/mavlink/#SERVO_OUTPUT_RAW | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you plz the extra new lines here?, and throughout if there are any other not needed newlines/spaces
|
||
""" | ||
|
||
def __init__(self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is quite the signature, did you explore any other options to the servo attributes?, perhaps kwargs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking about it kwargs makes sense here, if you don't have all the servo messages in kwargs, you won't be able to set them on the internal attrs of the class, you would then need to create a helper perhaps to get the servo message you are looking for .get(1)
or some sort of helper that makes sense (this is just an idea)
return "SERVO_OUTPUT_RAW: time_boot_us={},port={},servo1_raw={},servo2_raw={},servo3_raw={},servo4_raw={},servo5_raw={},servo6_raw={},servo7_raw={},servo8_raw={},servo9_raw={},servo10_raw={},servo11_raw={},servo12_raw={},servo13_raw={},servo14_raw={},servo15_raw={},servo16_raw={}".format( | ||
self.time_boot_us, self.port, self.servo1_raw, self.servo2_raw, self.servo3_raw, self.servo4_raw, | ||
self.servo5_raw, self.servo6_raw, self.servo7_raw, self.servo8_raw, self.servo9_raw, self.servo10_raw, | ||
self.servo11_raw, self.servo12_raw, self.servo13_raw, self.servo14_raw, self.servo15_raw, self.servo16_raw) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have been using the __str__
decorator for debugging purposes on all of our top-level classes, do you think this is the most useful representation of data we can get out of this class?, would you typically expect all of the variables to be set and by reading make something out of it?, what if we are logging this, do you think this is the appropriate way to read it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition, I would like it if you could make 2 PR's 1 for the servo class and the other for the much needed GoPro class.
I generally agree with your decisions but have some questions and advice I would like you to implement if you would like to continue contributing.
self.vehicle = vehicle | ||
FORMAT = '%(asctime)s, %(message)s' | ||
DATEFORMAT = "%d-%m-%Y, %H:%M:%S" | ||
logging.basicConfig(format=FORMAT, datefmt=DATEFORMAT, filename="camera_log.csv", filemode='w', level=logging.INFO) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would expect the logging to be part of some other utility, or at least to be able to change the file name and formats used by it, what do you think?
|
||
def log_vehicle_state(self, num_picture, cam_message): | ||
if self.vehicle: | ||
log_msg = ",".join(map(str,[num_picture, self.vehicle.commands.next, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should use the CSV lib for this, did you consider that when exploring this solution?
return str(e) | ||
|
||
|
||
class GoProHero3(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if having a base class Camera
object would be best here, you could inherit when creating a new camera object, that would allow us to maybe have a external modules, I would prefer that approach so we can standardize behind the same interfaces for cameras, this would allow for greater code re-use between apps.
# for a list of http commands to control the GoPro camera | ||
|
||
#TODO: convert these into methods. | ||
self.on = "http://10.5.5.9/bacpac/PW?t=" + self.wifipassword + "&p=%01" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you create a url builder util for this class?, and perhaps add the IP as a variable too
self.res5mpMedium = "http://10.5.5.9/camera/PR?t=" + self.wifipassword + "&p=%03" | ||
self.noSound = "http://10.5.5.9/camera/BS?t=" + self.wifipassword + "&p=%00" | ||
self.sound70 = "http://10.5.5.9/camera/BS?t=" + self.wifipassword + "&p=%01" | ||
self.sound100 = "http://10.5.5.9/camera/BS?t=" + self.wifipassword + "&p=%02" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you planning on adding all of these to the gopro interface? I wonder if we should have a generic command
class which is handling all of them, and expose shutter
as a top level user of command('shutter')
?
pass | ||
|
||
|
||
def send_http_cmd(cmd): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should def live inside the gopro class
@@ -1,216 +1,241 @@ | |||
#!/usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think your gopro example needs its own example section, the mission_basic example isn't a good fit since not all the users are using or will use a gopro
@peterbarker can you do some review of the APM interfaces and overall architecture plz? @hamishwillee do you have any pointers for documentation? |
Some of this is also in another PR. What I did: