-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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
AP_DDS: External Control enable #28429
base: master
Are you sure you want to change the base?
Conversation
@@ -636,6 +637,13 @@ void AP_DDS_Client::on_topic(uxrSession* uxr_session, uxrObjectId object_id, uin | |||
(void) request_id; | |||
(void) stream_id; | |||
(void) length; | |||
auto *external_control = AP::externalcontrol(); | |||
// TODO: Replace this line before merging. I leave the Joystick control always enable to test the RC functionality. |
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.
Replace this before merging.
@Ryanf55 what is the best way to make it testable? |
I'd do something like a mock flyaway recovery.
|
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've replicated your behavior, looks great! I think this is a nice clean way for a GCS to take authority from a companion computer.
Running SITL
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py transport:=udp4 synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1 master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501
mavproxy
param set RC6_OPTION 181
reboot
Then use the CLI to test with joystick.
@@ -740,8 +750,13 @@ void AP_DDS_Client::on_request(uxrSession* uxr_session, uxrObjectId object_id, u | |||
break; | |||
} | |||
|
|||
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "%s Request for %sing received", msg_prefix, arm_motors_request.arm ? "arm" : "disarm"); | |||
arm_motors_response.result = arm_motors_request.arm ? AP::arming().arm(AP_Arming::Method::DDS) : AP::arming().disarm(AP_Arming::Method::DDS); | |||
if (external_control->is_enabled()) { |
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 should ask the dev team whether they want to put arming
in external control and push all control handover logic into external control for things like arming, mode change, joystick, etc.
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 also ask the Dev team, what is the best way to add this functionality to the Ground Station? Maybe Using the Mavlink MAV_CMD_NAV_GUIDED_ENABLE
message?
259383a
to
d3f0cf6
Compare
User Story
As an operator, I want to be able to completely cut off any external control from the DDS interface. This functionality is especially helpful during debugging tests, when a quick reaction is of utmost importance.
I would like to be able to assign a switch to Enable/Disable external control, as well as the ability for a script or an external GCS to trigger External Control.
What Changed
false
.DDS_EXTERNAL_CONTROL = 181
which allows a channel to enable External control when HIGH.Test
/ap/joy
subscription always active, so it's easy to emulate an RC input.ros2 topic pub /ap/joy sensor_msgs/msg/Joy "{axes: [0.0, 0.0, .nan, .nan, .nan, -1]}"
ros2 service call /ap/arm_motors ardupilot_msgs/srv/ArmMotors "arm: true"
ros2 topic pub /ap/joy sensor_msgs/msg/Joy "{axes: [0.0, 0.0, .nan, .nan, .nan, 1]}"
ros2 service call /ap/arm_motors ardupilot_msgs/srv/ArmMotors "arm: true"