-
Notifications
You must be signed in to change notification settings - Fork 990
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
manual_control: add topic for sending MANUAL_CONTROL messages #919
Conversation
@@ -34,6 +34,7 @@ class ManualControlPlugin : public plugin::PluginBase { | |||
PluginBase::initialize(uas_); | |||
|
|||
control_pub = manual_control_nh.advertise<mavros_msgs::ManualControl>("control", 10); | |||
control_sub = manual_control_nh.subscribe("override", 1, &ManualControlPlugin::override_cb, this); |
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.
Should be called override_sub
in case topic name override
. Maybe name it send
?
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, send
is better. But, in such case, there'll be two topics, send
and control
, it's non-obvious, that these are send and receive, actually.
b5f4760
to
50cc899
Compare
I renamed |
50cc899
to
a6fffd7
Compare
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.
LGTM
@okalachev Could you give a brief explanation of how this works? When I use the example you give
My copter flies straight up while spinning about yaw , but if I pass 0 in for z, it just sits there. Is there a way to pass in normalized RC values? Thanks! |
First, the topic was renamed to |
Sorry--I just copy-pasted. I'm publishing it to /mavros/manual_control/send |
In PX4, Don't you have it working this way? |
Okay, thanks! I was sending in yaw values into z and throttle into r. |
@okalachev I modified the command to 'send'. It is output normally in rostopic ehco manual_control / send. However, the FCU is not responding. |
Sorry, I don't get your question. If you publish values to this topic then the vehicle should behave as it was a real RC. |
ok. |
my env : i tyed this in each terminal : roslaunch mavros px4.launch make px4_sitl_default gazebo ./QGroundControl.AppImage rosrun test mavkbteleop.py ( https://github.com/romaster93/px4_test/blob/master/mavkbteleop.py ) and All work. I can takeoff using QGroundControl. and i checked ' rostopic echo /mavros/rc/out ' : header :
channels : [900, 900, 900, 900, 900, 900, 0 ,0, 0 ,0 ,0 ,0 ,0 ,0 ,0] check 'rostopic echo /mavros/rc/in : header: check 'rostopic echo /mavros/rc/override' : channels: [1500, 1500, 1500, 1500, 1000, 1000, 1000, 1000] first, I believed that the drone would respond if I modified the override value. After, I saw your article and tried it. I typed in another terminal. rostopic pub -r 5 /mavros/manual_control/send mavros_msgs/ManualControl "header: I entered in terminal to confirm that the message was delivered. rostopic echo mavros/manual_control/send : header:
|
Basically you have to arm your drone before it will handle virtual RC commands. Maybe this is the problem? Also, if you want your drone to fly autonomously, it's generally better to utilize the OFFBOARD mode and setpoint commands. |
PX4 supports "overriding" manual control inputs via MANUAL_CONTROL message: https://github.com/PX4/Firmware/blob/master/src/modules/mavlink/mavlink_receiver.cpp#L1559 (did not check for APM).
I added
~manual_control/override
topic (not sure about the name, this is the analogy withrc/override
), allowing user to control the copter with a "virtual" RC with normalised values. For example:in
POSCTL
mode makes the copter fly up and rotate (tested in SITL).Also, I think
1
is the correct value forqueue_size
for such topics (rc/override
,manual_control/override
, etc), because we want to send relevant messages, we don't want to queue them.