-
Notifications
You must be signed in to change notification settings - Fork 17.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
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. |
630deda
to
1ac2319
Compare
1ac2319
to
000b7f6
Compare
@@ -3,8 +3,8 @@ | |||
#include <AP_HAL/AP_HAL_Boards.h> | |||
#include <AP_Networking/AP_Networking_Config.h> | |||
|
|||
#ifndef AP_DDS_ENABLED | |||
#define AP_DDS_ENABLED 1 | |||
#ifndef AP_EXTERNAL_CONTROL_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.
This is not correct, please revert
@@ -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?
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"