Unable to send RC commands to px4

#2

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

#3

Hello Coline,

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

#4

@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

#5

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.

#6

@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

#7

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.

#8

@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.

#9

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

#10

In mavros terminal I can see

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

#11

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

#12

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.

#13

@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?

#14

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.

#15

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

#16

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]?

#17

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

#18

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.

#19

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

#20

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.

#21

Hi Coline, thank you very much, I found out that, 500, was the neutral value as you said. My problem was that the behaviour in manual mode was different and confused me.

Now I can control the drone (in the simulator) using the manual_control message and the POSCTL flight mode, as expected.
The only dubt now, is about tha yaw. In the message description says:

R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle.

To me it’s not clear the corresponding degree value. I mean, is 1000 corresponding to a 360° yaw or what?
And [-1000,1000] is the real range of values? (the message description says -1000,+1000 even fro the ‘z’ but the right range is 0-1000)

Do you have an idea?