Simulation of Onboard application

Hi everyone,
I have an ODroid-XU4 (running Ubuntu 16.04) that should control (simultaneously) pixhawk (running Ardupilot 3.5) which controls Y6 hexacopter. I can send MAVLink messages from ODroid to Pixhawk. My code is written in C++ and I don’t want to program in Python. I can run “sim_vehicle.py” and I can connect APM planner to MAVProxy via udp. I can send commands like “Takeoff” in MAVProxy.
Here are two points I don’t understand:

  • How can I test my code (which should run on ODroid) that sends commands to pixhawk? I mean I’d like to test if I connected ODroid to Pixhawk and send these navigation control commands, pixhawk will respond in the correct way.
  • How to configure the SITL to simulate Y6 hexacopter with a specific Arudpilot version? I mean, when I run MAVProxy (using sim_vehicle.py) it just simulates a default quadcopter but I’d like to configure the simulation environment to be exactly as my real setup (Y6 hexacopter and Ardupilot 3.5).

I’m so lost and don’t know where I can find these info. I read MAVProxy documentation and SITL documentation but didn’t find answers.
I’d really appreciate your help, even just hints to the right direction.

Try sim_vehicle.py --help; you can set the frame option.

You can connect extra ground control stations to MAVProxy; look at the --out MAVProxy option. MAVProxy will listen on those addresses and forward packets to and from the vehicle.

To simulate a Y6 copter, use sim_vehicle.py --vehicle=ArduCopter --frame=y6

For a specific Ardupilot version, you’ll need to use the git command git tag to list the available tags, then git reset --hard <tagname> to reset the source to a specific tag.

Thanks Peter for your answer. I checked sim_vehicle.py --help and found good knowledge there. Thanks for this tip
Regarding the second point, it’s confusing for me because in the code (on ODroid), I send mavlink messages to Pixhawk via UART. How should I send the same messages to sim_vehicle.py. Is it as simple as just sending the buffer via udp as in this link?

QGroundControl might make a good source of information on how to send stuff via UDP.

But yes, you pretty much just squirt it out as a UDP packet.

https://github.com/peterbarker/dronekit-la/blob/master/telem_forwarder_client.cpp

Thanks Stephen for your answer.
I didn’t know that sim_vehicle.py compiles the source code before simulating it. I thought it just simulates a specific version of ArduCopter.
I followed your instructions by setting git reset --hard Copter-3.4.5 and git reset --hard Copter-3.4.6. When I run sim_vehicle.py --vehicle=ArduCopter --frame=y6, it gave me errors. I removed ardupilot and re-cloned it and now it’s working.
Thanks again

OK. I’ll read carefully your source code and try to get it to work.
Million thanks