Unable to send RC commands to px4

I am trying to send throttle command with ROS node using mavros and publish messages to topic [mavros/rc/override] but I am not getting any response from drone in gazebo simulator.

Hi Yograj,
I am having the same issue, did you figure it out?

Hello Coline,

I am still facing this issue , I will post in case I find solution. Please update if you solve the problem.
Thanks!

@Yograj_Singh_Mandloi Have you checked if the throttle commands are being received by PX4?

You can check by rc/in topic published by mavros

Hi @Jaeyoung-Lim,
In my case, rc/in is identical to the rc/override message I am sending, but rc/out is not being published. I am not quite sure what rc/out is supposed to be, so I don’t know if it matters.

@Coline rc/out is the output to the servomotors, so it shouldn’t matter on the issue you are experiencing

Have you checked if PX4 is actually receiving the rc messages?

You can check through a mavlink shell or maybe run qgroundcontrol and check

Thanks for the quick reply @Jaeyoung-Lim!
I typed “listener input_rc” in the mavlink shell and I got the following result:

TOPIC: input_rc instance 0 #1
timestamp: 771474335
timestamp_last_signal: 771474335
channel_count: 8
rssi: 100
rc_failsafe: False
rc_lost: False
rc_lost_frame_count: 0
rc_total_frame_count: 1
rc_ppm_frame_length: 0
input_source: 6
values: 1500 1500 1536 2000 65535 65535 65535 65535 0 0 0 0 0 0 0 0 0 0

Which matches what I am sending through Mavros, so it looks like PX4 is receiving the message.

@Yograj_Singh_Mandloi, I haven’t had any luck with rc/override however publishing to manual_control/send topic worked. It solved my problem, I don’t know if it’s applicable to you.

what msg type are you using to publish on this topic?

In mavros terminal I can see

> [ INFO] [1530250392.492639255]: RC_CHANNELS message detected!

Are you publishing values for throttle, roll, pitch etc commands or x, y and z values ?

I am no longer publishing to rc/override and instead I am publishing a ManualControl message to the send topic (ManualControl.msg). In that message x is the pitch, y the roll, z the throttle and r the yaw
http://mavlink.org/messages/common#MANUAL_CONTROL
I am not using the buttons so I just set it to 0.

@Coline When you said that rc/override was not making any response to the drone in SITL, what commands were you sending?

Could you see the props spin up when it is armed?

I could see the prop spin once armed (I am arming using the mavros service client). The mode was set to POSCTL. I was sending the following in the OverrideRCIn msg:
channels =[1500, 1500, 1500, 2000, 65535, 65535, 65535, 65535]. (roll,pitch,yaw,throttle, switches). The first four values are mapped to my joystick with values between 1000 and 2000. The first three are equal to 1500 when the sticks are neutral, and the throttle is at 1000 when the stick is neutral.

@Coline Could it be that you were sending maximum throttle values when the vehicle was armed?

1 Like

I just checked and I am sending [1500 1500 1500 1000 …] when arming. I send [1500 1500 1500 2000 …] after the drone is armed. Maybe there is an issue with my mapping, is throttle not channels[3]?

which flight mode are you using in case of ManualControl message ? and what values(x,y,z,r) are you publishing ?

Position control flight mode. The values for x,y,r are between -1000 and 1000, 0 is neutral. The value for z is between 0 and 1000, 500 is neutral. I am sending neutral values when arming and engaging the position control flight mode. I use a joystick to modify the values and control the flight.

Hi Coline! I tried the same configuration, but the behaviour of z value is not as you described.

I did the following:

  • started simulator (JMAVSim)
  • started mavros and succesfully connected to simulator
  • started script:
    – I’m publishing manual_control msg to /mavros/manual_control/send
    – I’m using MANUAL flight mode (but I have the same problem even with STABILIZED)
    – I’m trying the following list of messages at 33hz rate (in order x,y,z,r,buttons)

0, 0, 550, 0, 0, 0 #take off, for 2 seconds
0, 0, 500, 0, 0, 0 #stay still for 3 seconds
0, 500, 500, 0, 0, 0 #right for 2 seconds
0, 0, 500, 0, 0, 0 #still for 3 seconds
0, -500, 500, 0, 0, 0 #left for 2 seconds

My problem is that, x and y value are ok, but z=500 is not the neutral, the drone starts climbing and continues climbing till the end.
If I set z = 0 for neutral position (like written in the official documentation where the range is [-1000,+1000]), the drone falls down immediately.

If I set the POSCTL flight mode, the drone arms correctly but doesn’t move.

What am I missing?
Please help me because it’s very frustrating.

Regards,
Davide

Hi Davide,

I believe that in manual and stabilized modes the altitude is not controlled, and it will be hard to maintain the altitude without a feedback. The throttle command controls the throttle directly, and what value of throttle corresponds to hover (neutral) would depend on each drone.
You have to use altitude control or position control to have a controlled altitude.
I haven’t used PX4 for a while so I don’t know if anything in the implementation of position control has changed since I used it. Sending 500 was the neutral then, but it might have changed.
There is a large deadband on the altitude so you’d probably have to send more than 550 to see anything happen in position_control.