HomeGuides
Log In

Configuration file

The default configuration file of the PX4 VSM suits most needs and it is generally not necessary to modify it.

Configuration file location:

• Microsoft Windows:
C:\Program Files (x86)\UgCS\bin\vsm-px4.conf

• GNU/Linux:
/etc/opt/ugcs/vsm-px4.conf

• Apple OS X:
/Users/[user name]/Library/Application Support/UGCS/configuration/vsm-px4.conf

Common parameters

All VSMs share a common set of configuration file parameters described in Common configuration file parameters. PX4 VSM configuration file prefix is:

vehicle.px4

Communication channel configuratio

There must be at least one communication channel defined, otherwise, VSM will not try to connect to the vehicle. See Communication with devices for details.

The default installation is configured to detect autopilot automatically on any available serial port at 57600 or 115Kbps.

Model name and serial number override

Optional

• Name: vehicle.px4.custom.[name].system_id = [system id]

• Name: vehicle.px4.custom.[name].model_name = [model name]

Configuration file

• Name: vehicle.px4.custom.[name].serial_number = [serial number]

• Description:
In UgCS each vehicle is identified by a unique combination of the model name and serial number represented as text strings. By default, PX4 vehicles are identified with a model name PX4 and a serial number equal to the Mavlink system id read from the vehicle. It can be overridden by these parameters, where [name] is an arbitrary vehicle name, [system id] is the original Mavlink system id which should be overridden, [model name] is a new model name to be visible to the UgCS, [serial number] is a new serial number to be visible to the UgCS.

• Example:

vehicle.px4.custom.my_drone.system_id = 2
vehicle.px4.custom.my_drone.model_name = PX4Quad
vehicle.px4.custom.my_drone.serial_number = 123456

Camera trigger type

There are different ways to control the camera payload in the px4 family. The first one is the "common" one and utilizes SET_SERVO or REPEAT_SERVO commands. Camera trigger control is linked with autopilot servo output and triggering takes place when we send the proper amount of PWM signal in that output.

The second one is when we use high-level commands MAV_CMD_IMAGE_START_CAPTURE and MAV_CMD_IMAGE_STOP_CAPTURE to control the trigger.
So we introduce the parameter

vehicle.px4.camera_trigger_type

When it is set to 0, VSM will use high-level commands MAV_CMD_IMAGE_START_CAPTURE and MAV_CMD_IMAGE_STOP_CAPTURE And when it set to 1 - VSM will use MAV_CMD_DO_REPEAT_SERVO command along with camera_servo_idx, camera_servo_pwm, and camera_servo_time parameter values.

Telemetry rate configuration

PX4 VSM supports setting custom telemetry rates based on mavlink message type. There are 8 message types that are used by VSM to get the essential state info from the vehicle: SYS_STATUS, GLOBAL_POSITION_INT, ATTITUDE, VFR_HUD, GPS_RAW_INT, ALTITUDE, HEARTBEAT, HOME_POSITION.

Other messages which are sent by autopilot are disabled by VSM to save datalink channel bandwidth.

It is possible to configure the rate for each message type separately.

• Required: No.

• Supported values: 0.1 - 50.0

• Default: 2

• Description: Message count per second.

• Example:

vehicle.px4.telemetry_rate.ALTITUDE = 0.5
vehicle.px4.telemetry_rate.ATTITUDE = 0.5
vehicle.px4.telemetry_rate.GLOBAL_POSITION_INT = 0.5
vehicle.px4.telemetry_rate.GPS_RAW_INT = 0.5
vehicle.px4.telemetry_rate.HEARTBEAT = 0.5
vehicle.px4.telemetry_rate.HOME_POSITION = 0.5
vehicle.px4.telemetry_rate.SYS_STATUS = 0.5
vehicle.px4.telemetry_rate.VFR_HUD = 0.5

Mavlink version

PX4 VSM supports MAVLink versions 1 and 2 and detects the correct version automatically. In setups when there is some intermediate device between VSM and autopilot this detection can fail. For those scenarios, it is possible to force mavlink version used by VSM.

• Required: No.

• Supported values: 1 2 auto

• Default: auto

• Description:
1: always use mavlink version 1,
2: always use mavlink version 2,
auto: Autodetect mavlink version.

• Example:

vehicle.px4.mavlink_protocol_version = 1

Force heading to next WP

By default, VSM will automatically generate commands for the vehicle to set heading towards the next waypoint. This behavior can be disabled by setting the parameter "autoheading" to no. See also the Heading behavior

• Required: No.

• Supported values: yes, no

• Default: yes

• Description:
no - do not change the heading between waypoints. This disables the override of parameter MIS_YAWMODE on mission upload. Vehicle heading will depend on MIS_YAWMODE. If MIS_YAWMODE is set to 1 (next WP) then all heading actions in the mission will be ignored.

yes - change heading towards the next waypoint. When set, each mission upload sets MIS_YAWMODE to zero (yaw controlled by mission)

• Example:

vehicle.px4.autoheading = no

Mavlink message injection

Ardupilot VSM can receive mavlink packets and forward them to the vehicle if a vehicle with a specified target_id is connected. It can be used to send GPS RTK corrections to vehicles. If a message has no target_id or traget_id is 0 then it is sent to all connected vehicles. Supported messages are COMMAND_LONG, COMMAND_INT, GPS_INJECT_DATA, and GPS_RTCM_DATA. The prefix mavlink_injection supports all the same syntax as the "connection" prefix.

• Required: No.

• Supported values: Same as those for connection prefix.

• Default: Not set.

• Example:

mavlink_injection.udp_any.1.local_port = 44444

Mavlink System ID

MAVlink System ID used for outgoing MAVlink messages.

• Required: No.

• Supported values: 1 - 254

• Default: 1.

• Example:

mavlink.vsm_system_id = 100