Unexpected command from mavros

I am using Ardurover for floating drone and working on anticollision system.

I am trying to send mavlink commands via mavros to ardupilot rover.

mavsafety arm/disarm is working fine, but I can’t change mode of the autopilot.

I am sending message with: rosrun mavros mavsys mode -b 4
I am getting response: CMD: Unexpected command 11, result 3

I run out of ideas how to solve this. Any idea of what might be the issue?
Any help appreciated.

All the best!

v-to

@v-to,

I’m not much of a ROS expert but I put together this wiki page and it seems to change mode the command would be, “rosrun mavros mavsys mode -c 4”

Thanks rmackay9 for this quick answer and hint.
I’ve tried this before though. -c is for custom modes, which are not supported by mu FCU - I’ve got mode:Unsupported FCU in reply.
So I can choose only between basic modes (-b).
I feel like it is more ardupilot issue rather than ROS - the command is being sent properly, but FCU doesn;t accept it in its particular state for some reason.

I had similiar problem before with DO_SET_SERVO and the solution was to … switch joystick on in GCU…
BUt it still doesn’t help for changing mode.

Any other ideas?

rgds

VV

@v-to,

I’m pretty sure that it must be “-c”. Perhaps try connecting a ground station to the flight controller to test changing modes and see if it displays a message. Alternatively the dataflash logs will contain a message saying why requests to change flight mode failed.

Thanks gents. In this situation I will try to debug Mission Planner to see what it sends from GCS while changing mode.

What do you mean by “dataflash logs”?

ROS logs only says “Unsupported FCU”

Rgds

VV

So, Mission Planner can change modes via GUI and via Joystick. As I can see in code cmd 176 is used.
Anyway no luck with mavros :frowning:

commands:
hd@nawigacyjny:~$ rosrun mavros mavsys mode -b 4
hd@nawigacyjny:~$ rosrun mavros mavsys mode -c HOLD
Request failed. Check mavros logs
hd@nawigacyjny:~$ rosrun mavros mavcmd long 176 0 HOLD 0 0 0 0 0
usage: mavcmd long [-h] [-c] [-b]
command param1 param2 param3 param4 param5 param6 param7
mavcmd long: error: argument param2: invalid float value: ‘HOLD’
hd@nawigacyjny:~$ rosrun mavros mavcmd long 176 0 4 0 0 0 0 0
Request failed. Check mavros logs. ACK: 3
hd@nawigacyjny:~$ rosrun mavros mavcmd long 176 0 0 0 0 0 0 0
Request failed. Check mavros logs. ACK: 3
hd@nawigacyjny:~$ rosrun mavros mavcmd long 176 0 4 0 0 0 0 0
Request failed. Check mavros logs. ACK: 3
hd@nawigacyjny:~$ rosrun mavros mavcmd long 176 0 0 0 0 0 0 0
Request failed. Check mavros logs. ACK: 3
hd@nawigacyjny:~$ rosrun mavros mavsafety arm
hd@nawigacyjny:~$ rosrun mavros mavcmd long 176 0 4 0 0 0 0 0
Request failed. Check mavros logs. ACK: 3
hd@nawigacyjny:~$ rosrun mavros mavcmd long 176 0 0 0 0 0 0 0
Request failed. Check mavros logs. ACK: 3

Responces:
[ WARN] [1565947314.909183781]: CMD: Unexpected command 11, result 3
[ WARN] [1565947326.511162588]: TM : RTT too high for timesync: 1565941334950.23 ms.
[ERROR] [1565947381.779252178]: MODE: Unsupported FCU

I ran out of ideas …
Any concept?

rgds

VV

@v-to,

Dataflash logs are discussed here on the wiki.

I’m not sure what the issue is with mavros. I’ve certainly been able to change modes. Maybe someone in this gitter chat will know.

EDIT: it might also be good to compare your setup to what is described on the wiki here.

Gents,

I’ve check the logs and I didn’t find anything…

Anyway our site test are finished already and at the moment I have no direct access to hardware.

I will try to duplicate the environment In SITL and get back to the issue, hopefully before tests in September.

Many thank for help -probably I will bother you again soon :wink:

Rgds

VV

1 Like

I know that this topic is quiet for more than one year now, but I’m facing a similar problem and I was wondering if you were able to solve your problem.

Hi Carlos,

We did finally, after long battle. An upgrade of ardurover to the newest version this year and usage of custom modes "rosrun mavros mavsys mode -c 4” was the solution.

Hope it will help you too.

all the best

v-to

Hi @v-to,
Thank you for getting back to me! To be completely honest with you. I was always able to change the mode, but I keep getting an error:

CMD: Unexpected command 11, result 0

Although the mode does change as I get feedback from the pixhawk and I can also see it in Mission Planner. Do you also get the same error?

Another thing you’ve mentioned was that you had been able to work with a SERVO using DO_SET_SERVO. I guess you’re referring to MAV_CMD_DO_SET_SERVO, (command 183). Is that right?
I’ve tried to use it by issuing

rosrun mavros mavcmd int 183 1 1023 0 0 0 0 0

But I’m getting the error

CMD: Unexpected command 183, result 3

I’ve also tried to publish it to OverrideRCIn with no luck.

rostopic pub /mavros/rc/override mavros_msgs/OverrideRCIn -r 50 ‘[1021, 0, 1500, 0, 0, 0, 0, 0]’

I mean… it doesn’t give any error this one, but it also doesn’t make the servo move! :slight_smile:

I’m sorry for dumping all of these doubts, but I’ll pick your mind for some info if you don’t mind!

Hi Carlos,

Yes and No :wink:

Yes. I was using command 183, but it was working also with some servos, like searchlight or additional appliances. However I was not able to change mode with this command.

I got, what you have Unexpected command 183, result 3.

In fact we didn’t find the error source. We swithed to other things for a couple of months and when we came back we updated ardurover and it started to work.

In fact I was not personally involved in this.

I am sorry I cannot help you here :frowning:

Good luck anyway

v-to

Hi @v-to,
Ok, thanks anyway! I appreciate your answer anyway.
Cheers,
Carlos

@Carlos_Vicente
Hi Carlos,

So I am back with this stuff now and I am back with this problem again…
It appeared that othert guys had some solution but it was not fully functinal and they didn;t know in fact how it worked…
Now I am back fro other project and I am trying to find a solution for this again.

So, can you please tell me if you had any luck with this?

Kind regards’

Witold