-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
@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.
259383a
to
d3f0cf6
Compare
d3f0cf6
to
42c31a0
Compare
Could this be done at the top RC_Channels level rather than down in plane and copter? Then it should work for rover too. |
42c31a0
to
630deda
Compare
Suggestions have been applied, rebased and tested. |
1ac2319
to
000b7f6
Compare
@@ -749,8 +757,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.
Can we instead put an arm
function into the external control library, and check is_enabled
there, then call AP::arming().arm
there?
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.
same for the other services though, right?
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.
Yep, I think so. For the over services, that could/should be it's own PR. I'll do that now.
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.
so you would call external_control->arm()
, which would fail if either the external control is disabled or arming failed.
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.
yes
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.
Here's the implementation. Once this merges, rebase.
#28609
000b7f6
to
624ec21
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
ros2 topic pub /ap/joy sensor_msgs/msg/Joy "{axes: [0.0, 0.0, 0.0, 0.0, .nan, 1]}"
Command rejected: External Control Enabled
.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"