Home        Store        Docs        Blog

ArduSub SITL Custom frame

I’ve been trying to add a custom frame and test it in SITL. I’m also using QGroundControl.

QGC seems to support 6 frames but when I try to use any other than BlueROV2/Vectored and Vectored-6DOF it doesn’t work.

Here are my steps for anyone interested.

  1. Modify SITL_cmdline.cpp and add your frame name to model_contructors[]
    { “MY_FRAME”, Submarine::create },

  2. In SIM_Submarine.cpp add your Thruster config.
    Also add an if statement for your frame in Submarine::Submarine

    if (strstr(frame_str, “MY_FRAME”)) {
    thrusters = MY_FRAME_thrusters;
    n_thrusters = 6;

  3. In AP_Motors6DOF.h add an enum for your frame to the sub_frame_t (The location of this is important to match changes in QGroundControl. I added mine after CUSTOM so it was number 8)

4 In AP_Motors6DOF.cpp add in your case statement. The add_motor_raw_6dof calls should match what you put in SIM_Submarine.cpp.

  1. In AP_Motors6DOF.cpp check out the function output_armed_stabilizing. My frame was similar to vectored so I just added an else if to call output_armed_stabilizing_vectored() for my frame.

  2. I also modified vehicleinfo.py to add my frame and make it the default_frame.

Hi @Tautala,

Thank you for sharing!

This commit adds a 6dof frame to SITL and can be used as sort of a template.

It adds a frame that can be selected using sim_vehicle.py --frame vectored_6dof

Thanks @williangalvani. That commit matches what I did.

Changes required in QGroundControl

  1. Vehicle.cc in Vehicle::motorCount() in case MAV_TYPE_SUBMARINE add to the enum and add the case for your frame returning the number of motors on your sub. Note: the ordering of this enum matches the changes in ArduSub.

  2. In APMSubFrameComponentSummary.qml add a case for your sub in function frameName(). Also the case number (in my situation it is 8 since I added after CUSTOM) is whatever location in the enum(s) your frame is.

  3. In APMParameterFactMetaData.Sub.4.0.xml in <param humanName=“Frame configuration” name=“ArduSub:FRAME_CONFIG” add a <value code=“8”>My Frame</value> Note: 8 is th place in the enum(s) for my frame.

  4. qgcimages.qrc add a line for your frame image matching the those already there and put your image in the right place.

  5. APMSubFrameComponent.qml add a ListElement for your frame under ListModel id:subFrameModel. The paramValue should match your location in the enums and cases. Also add a QCGButton for your frame in the Component selectParamFileDialogComponent

  6. APMSubMotorDisplay,qml in the function getImage add a case (same number as the enums) to return your image.

I think that’s it. If anyone sees that I’m off target please let me know.

Also, you can replace src/FlightMap/Images/sub.png if you want.


1 Like