-
Notifications
You must be signed in to change notification settings - Fork 8
send_statustext_message #71
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
Conversation
maxlou05
left a comment
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.
Reviewed
modules/mavlink/flight_controller.py
Outdated
| Sends a STATUSTEXT message to the vehicle. | ||
| """ | ||
| message_bytes = message.encode("utf-8") | ||
| msg = vehicle.message_factory.statustext_encode(severity, message_bytes) |
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 check to make sure there is a target_system and target_component parameter? Please use the ones specified in the example. Also, are you able to test this? Could you write an integration test that just runs this (ie sends a bunch of messages)? You will connect to mission planner just as described in the example, and then see if you can see the messages in mission planner. (Let me know if you need help testing)
maxlou05
left a comment
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.
Reviewed
modules/mavlink/flight_controller.py
Outdated
|
|
||
| def send_statustext_msg( | ||
| self, | ||
| vehicle: dronekit.Vehicle, |
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.
Remove this from the function signature, you should use self.drone as the vehicle.
modules/mavlink/send_messages.py
Outdated
| controller.send_statustext_msg(controller.drone, msg, mavutil.mavlink.MAV_SEVERITY_INFO) | ||
| time.sleep(1) # Wait 1 second between messages | ||
|
|
||
| controller.drone.close() |
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.
Probably don't need this, since I think you're not supposed to access controller.drone outside the class.
maxlou05
left a comment
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.
Reviewed
| controller.send_statustext_msg("") | ||
| else: | ||
| print("Failed to get odometry") | ||
| controller.send_statustext_msg("Failed to get odometry") |
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.
Leave this as a regular print, as we would want to see on the terminal what errors we get
| controller.send_statustext_msg("alt: " + str(home.altitude)) | ||
| else: | ||
| print("Failed to get home position") | ||
| controller.send_statustext_msg("Failed to get home position") |
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.
Leave as print
| controller.send_statustext_msg("Downloaded commands:") | ||
| for command in commands: | ||
| print(command) | ||
| controller.send_statustext_msg(str(command)) | ||
| else: | ||
| print("Failed to download commands.") | ||
| controller.send_statustext_msg("Failed to download commands.") |
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.
Leave these as prints
| controller.send_statustext_msg("next waypoint alt: " + str(next_waypoint.altitude)) | ||
| else: | ||
| print("Failed to get next waypoint.") | ||
| controller.send_statustext_msg("Failed to get next 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.
leave as print
| result, home = controller.get_home_position(TIMEOUT) | ||
| if not result: | ||
| print("Failed to get home position") | ||
| controller.send_statustext_msg("Failed to get home position") |
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.
leave as print
| result = controller.upload_land_command(home.latitude, home.longitude) | ||
| if not result: | ||
| print("Could not upload land command.") | ||
| controller.send_statustext_msg("Could not upload land command.") |
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.
Leave as print
maxlou05
left a comment
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.
Reviewed
| success, controller = FlightController.create("tcp:localhost:5672") | ||
| if not success: | ||
| print("Failed to connect") | ||
| return 1 |
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.
Could you make this return -1 instead?
| Main function. | ||
| """ | ||
| # Connect to the vehicle | ||
| success, controller = FlightController.create("tcp:localhost:5672") |
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 make the address a global variable like in test_flight_controller.py?
|
|
||
| for msg in messages: | ||
| controller.send_statustext_msg(msg, mavutil.mavlink.MAV_SEVERITY_INFO) | ||
| time.sleep(1) # Wait 1 second between messages |
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 make DELAY a global variable like in test_flight_controller.py?
maxlou05
left a comment
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.
Conditionally approved
|
|
||
| for msg in messages: | ||
| controller.send_statustext_msg(msg, mavutil.mavlink.MAV_SEVERITY_INFO) | ||
| time.sleep(DELAY_TIME) # Wait 1 second between messages |
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.
You can remove the comment here
| from pymavlink import mavutil | ||
|
|
||
| from modules.mavlink.flight_controller import FlightController | ||
|
|
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.
Add one more space here (2 spaces to separate import from constants)
No description provided.