Custom MavLink Channel communication with jMavSim Simulation

Hello,
I’m new to PX4 and just kind of got thrown into an old project that nobody really knows the details of anymore…
That project was about controlling a Horus Octocopter Drone via offboard flight commands to keep a certain offset to another PX4 unit. The idea is to fly the drone manuallly into position, then flip a switch on the Remote and have the drone stay in its relative position to another PX4 module which is then mounted on a vehicle. Before testing this on the real Drone, it was of course simulated. For simulation purposes the second PX4 unit won’t be needed, because the position from which the offset is kept is just a variable in the code.
Unfortunately there is not a lot of documentation on how the simulation was set up exactly. So as far as I got now, I have an ubuntu system running similiar to the one on the actual drone. On this system there is an instance of jmavSim running, simulating the physical Drone with its PX4 control unit, then there is an instance of QGroundControl running, communicating with it and showing its location on the map. I don’t know if on the real drone you would run QGroundControl on the same OS and not aon a seperate Computer on the ground, but for simulation purposes it doesn’t really matter. I can start flying using QGroundControl and bring the drone into position. Now I can run the project’s code which also establishes a connection with jMavSim. The code is then waiting for the command to start it’s offset keeping procedure. And that’s where I get stuck because I have no idea how to do this in the simulation.
With the actual drone and the Remote Control (FrSky X10S), I just flip one of the levers.

In the actual code it’s a simple if statement:

if (mavChannels.chan6_raw > channelMin + 0.67 * (channelMax - channelMin) && !scoutingOn) {

with

mavlink_rc_channels_t mavChannels;
uint16_t channelMin = 982;
uint16_t channelMax = 2006;

My question would be: How do I send data on “channel 6” using this simulation setup? My guess would be that somehow QGroundControl provides some functionality for that but I couldn’t find it.

Sorry for the long post, also sorry if this is a stupid question… I hope it’s answerable.

Yer, that sounds a bit tricky. I’m not sure if you can send any RC channel value via QGC as it usually sends the MANUAL_CONTROL message rather than the RC_CHANNELS message.

A couple of years ago it was also possible to use a Pixhawk with RC connected for SITL but that is no longer available.

What you could also consider is using SIH which might allow you to use normal RC and still use simulation.

Thank you for the answer! And sorry for the late reply. I’m only able to test stuff once or twice a week so it took a while. SIH seems to be working. I can use the real remote control to fly around in QGroundControl. However the visualization with jmavsim doesn’t work since the parameter -d /dev/ttyACM0 seems to cause an an error where port ACM0 is either missing or busy. Without the parameter the simulation starts but doesn’t react to flying around. But that seems to be worth of a new discussion, maybe there is already one on the forum so thank you for your help :slight_smile:

Make sure to not use the port with something else. Most likely you have QGC open and auto-connecting to /dev/ttyACM0.