Gazebo Multi-Vehicle Simulation how to modify vehicle heading raw value

Hi.

I have button like rotate in QGC to modify heading value of vehicles in Gazebo multi-vehicle simulator.
Please help me with this issue , I have tried below steps:

  • vehicle->heading()->setRawValue(30)

  • vehicle->heading()->forceSetRawValue(30)

  • vehicle->heading()->setCookedValue(30)

but its again resetting to it initial position as default value(90 deg ), so I don’t want it to reset.

Thanks in advance`.

Do you want the vehicles to be spawned with a different heading or do you just want to display the heading differently in QGC?

If you actually want them to be spawned differently, you need to add arguments here:

You can add roll, pitch, yaw using -R, -P, -Y (see man) in radians.

Thanks @JulianOes , I want to rotate vehicle at certain angle by clicking on a button in qgc.

Aha, you want to send a yaw command using QGC? Is that it?

Yes, I want to send yaw value from QGC.

You might be able to do that in the same way that goto is implemented.

Here is how the command is sent to do a DO_REPOSITION:

And the params for that command are:

https://mavlink.io/en/messages/common.html#MAV_CMD_DO_REPOSITION

Param4 is yaw.

Thanks a lot, it’s working, I have tried by changing param4 to zero ,I’ll pass heading value as parameter to goto function I’ll use that parameter value at param4. Once again thanks a lot.

1 Like