Remote control interface protocol v2


  1. Overview
  2. Axis bitmask
  3. Remote control configuration
  4. Write and read SDOs directly
  5. State control
  6. Simulation control
  7. Settings control
  8. Profile control
  9. Input control
  10. Input interdiction control
  11. Reading data
  12. Reading/Writing IO2CAN Gateway data
  13. Setting IO2CAN Gateway output communication timeout
  14. Override control



To understand the protocol and be able to avoid pitfalls, please read "General information" before attempting to build packets.
Go to top

Overview

The Remote control protocol v2 has been introduced to cope with the increasing amount of controllable axes in CLS2Sim.
It allows issuing commands for multiple or single axes by using a bit field.
Additional commands for controlling the state of the control loading system have been implemented.
This allows the initialization, stop, or fault reset of any axis over the remote control interface.
If you are using profiles, the active profile can no be selected by name over the remote interface.

All settings written by the remote interface will NOT be displayed in the Profile manager.
Only state changes and selecting a profile triggers a visible change.
Clicking on "Ok" or "Apply" in the profile manager will override all settings done over the remote interface.


The size of response packets can vary.


Addresses for writing are not allowed to be read and will always return 0 when reading.


In a dual-seat set-up, all Settings and Data except reading force information (Data ID 0x20/0x21 Applied Force) and button presses (Data ID 0x30 Button presses) is synchronized. Therefore it is only exposed as a single value regardless if the hardware set-up is single- or dual-seat.

Go to top

Axis Bitmask

The Axis Bitmask allows the selection of axes or node ids to execute commands for.
Axis bitmask values can be ORed together to control multiple axes simultaneously, or the 'Node ID Mode' mask can be ORed with a single node id.
The device ids are the CAN node ids of the drives. They are used in the response of the GetStatus command and identify the status packets.
When working with a command, that responds with device ids, please note:The size of response packets can vary.



When sending the GetStatus request, the response will contain ALL specifically defined axes from the axis bitmask (from Elevator to Seatshaker), including not connected ones.

Exception: If you have generic axes (Node ID 10 to 19) they will be in the response only if they are connected and if you use the axisbitmask ALL (0xFFFFFFFF).

Example: Requesting Axisbitmask (0x7) (Elevator, Aileron and Rudder) status will always return the packet body six times, once for pilot and once for copilot, even if the setup is only one yoke.
Even if there are no second yoke and no rudder pedals connected, the selected ids will be returned. The not existing ones will have the status 0x00 (Not connected) and a temperature of 0.
If you have any generic axes connected, they will not be included in the response, as you have not selected axisbitmask ALL (0xFFFFFFFF).


When sending the GetError request, only connected devices respond. Devices with no errors will send no data and devices with multiple errors will send a packet body for each error.


Always allow for a dynamic number of devices to be returned when parsing any response packet!


NameAddressDevice IDs (Pilot, Copilot)
Elevator 0x1 2, 4
Aileron 0x2 1, 3
Rudder 0x4 5, 6
Collective 0x8 7, 8
Brakes left 0x10 101, 103
Brakes right 0x20 102, 104
TrimElevator 0x40 105, 106
TrimAileron 0x80 107, 108
TrimRudder 0x100 109, 110
Throttle1 0x200 111
Throttle2 0x400 112
Throttle3 0x800 113
Throttle4 0x1000 114
SpeedBrake 0x2000 115
NoseWheel 0x4000 116, 117
Seatshaker 0x8000 118, 119
Node ID Mode
Single Node ID <ID> (0x01 - 0x7E)
0x<ID>FFFFFF The specific <ID>
Example for Node 11: 0x0BFFFFFF



Go to top

Remote control configuration

Remote control settings


Setting name Setting id Value type ( Range ) Description
Communication timeout watchdog 0x00 Uint16 ( 0..65535 )
Time in milliseconds
Setting the value 0 deactivates the watchdog behind this setting.
Setting any other value, activates a watchdog, which waits X milliseconds, with X being the set value.
The watchdog is activated and also reset, by sending this command. After activating this setting with a value other than 0,
the thirt-party application connected via remote interface has to constantly resend this command, to reset the watchdog timer again.
The passed value determines each time, how long the watchdog will wait for the next reset command.
If the third-party application does fail to send the command in time, the watchdog is triggered and it will stop all drives connected to CLS2Sim. Also If a timeout has been set for any IO2Can device, that device will have its outputs pulled low.
Setting 0 also deletes all configured IOdevice timeouts, so those will have to be set again.


Request for remote control config commands


Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Setting id
Type: UInt32
Setting value
Type: See remote control settings table
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD8 : RemoteControlConfig 0x00 : Communication timeout watchdog set time & reset See remote control settings table

Response for remote control config commands


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Unknown Error
0x02 : BadIdOrCommand sent command
0x04 : BadLength 1 byte actual length, 1 byte required length



Go to top

Write and read SDOs directly

SDO Read command


Request for SDO Read command


Can be repeated for reading multiple SDOs with a single request.
Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Node
Type: UInt8
Index
Type: UInt16
Subindex
Type: UInt8
Timeout
Type: UInt16
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xCA : SdoRead Node ID (1 - 126) SDO Object Index SDO Object Subindex Timeout in milliseconds

Response for SDO Read command


Repeated for each defined SDO in SDO read request.
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Sdo Content
Type: Byte[4]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Sdo Abort
0x02 : Sdo Timeout
0x03 : General Error
On Success: Value
On Sdo Abort: Abort error code
On Sdo Timeout: 0
On General Error: 0


SDO Write command


Request for SDO Write command


Can be repeated for writing multiple SDOs with a single request.
Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Node
Type: UInt8
Index
Type: UInt16
Subindex
Type: UInt8
Size
Type: UInt8
Value
Type: Byte[4]
Timeout
Type: UInt16
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xCB : SdoWrite Node ID (1 - 126) SDO Object Index SDO Object Subindex Byte Size of Value (1/2/4) Value to write
LSB order
Padded to 4 bytes
Example 1000 = 0xE8, 0x03, 0x00, 0x00
Timeout in milliseconds

Response for SDO Write command


Repeated for each defined SDO in SDO write request.
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Error Code
Type: Byte[4]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Sdo Abort
0x02 : Sdo Timeout
0x03 : General Error
On Success: 0
On Sdo Abort: Abort error code
On Sdo Timeout: 0
On General Error: 0



Go to top

State control

State machine


The remote interface exposes 3 commands for controlling the state of the hardware.
  • The Init command triggers drive axis initialization.
    After initialization the SetOffsetSensor Command must be called.
  • The SetOffsetSensor command triggers force sensor calibration.
    This command must be used after init. After init and this command have finished, the drive is ready.
  • The Stop command shuts the drive down.
    It removes all power from motors, but does not brake actively.
  • The FaultReset command brings a drive out of fault mode into stop mode.
Additionally there are 2 commands for information retrieval.
  • The GetStatus command returns state and temperature information.
  • The GetErrors command returns error information.

Request for state commands


Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Axis
Type: UInt32
State command
Type: UInt32
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xCD : State control 0x00000001 : Elevator
0x00000002 : Aileron
0x00000004 : Rudder
0x00000008 : Collective
0x00000010 : Brake left
0x00000020 : Brake right
0x00000040 : Elevator Trim Wheel
0x00000080 : Aileron Trim Wheel
0x00000100 : Rudder Trim Wheel
0x00000200 : Throttle 1
0x00000400 : Throttle 2
0x00000800 : Throttle 3
0x00001000 : Throttle 4
0x00002000 : Speedbrake
0x00004000 : Nosewheel
0x00 : Get status
0x01 : Initialize
0x02 : Stop
0x03 : Fault reset
0x04 : Get errors
0x05 : SetOffsetSensor
0x06 : GetConnectionStats
0x07 : ResetConnectionStats

Response for GetStatus command


Repeated for each device id
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Device id
Type: UInt16
Device state
Type: UInt16
Device temperature
Type: UInt16
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success See Axis Bitmask 0x00 : Not connected
0x01 : Operational
0x02 : Not initialized
0x03 : Error in drive
Degrees Celsius


Response for GetConnectionStats command


If the values are negative, the data is invalid.


Max values will contains spikes from the connection phase.
After CLS2Sim has connected and is communicating with both hardware and simulation,
Allow 30 seconds for communication to settle, then send a ResetConnectionStats (0x07) state command.
After that, max values will mirror communication statistics during normal operation.

Field Datatype Description
Packetlength UInt16 Length of the rest of the packet
Message Identifier(optional) UInt32 This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
Status UInt8 0x00 : Success
Main loop min Int32 Fastest Main loop update time in ms since last statistics reset
Main loop max Int32 Slowest Main loop update time in ms since last statistics reset
Main loop avg Int32 Average Main loop update time in ms since last statistics reset
Pos loop min Int32 For all connected drives, shows the fastest update interval in ms since last statistics reset
Pos loop max Int32 For all connected drives, shows the slowest update interval in ms since last statistics reset
Pos loop avg Int32 For all connected drives, shows the average update interval in ms since last statistics reset
Simulation loop min Int32 For the connected simulation, shows the fastest update interval in ms since last statistics reset
Simulation loop max Int32 For the connected simulation, shows the slowest update interval in ms since last statistics reset
Simulation loop avg Int32 For the connected simulation, shows the average update interval in ms since last statistics reset
PDO/s current Int32 How many CANopen PDOs CLS2Sim received in the last second
PDO/s max Int32 Maximum PDO/s received since last statistics reset
PDO/s min Int32 Minimum PDO/s received since last statistics reset
SDO/s current Int32 How many CANopen SDOs CLS2Sim received in the last second
SDO/s max Int32 Maximum CANopen SDO/s received since last statistics reset
SDO/s min Int32 Minimum CANopen SDO/s received since last statistics reset
SDO timeouts/s Int32 How many CANopen SDOs timed out in the last second
SDO timeouts total Int32 How many CANopen SDOs timed out since last statistics reset
vJoy update time Int32 Maximum amount of time (ms) needed to update vJoy positions, since last statistics reset

Response for Init, Stop and Faultreset commands ( and GetStatus command in case of error )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Unknown Error
0x02 : BadIdOrCommand sent command
0x04 : BadLength 1 byte actual length, 1 byte required length

Response for GetErrors command ( in case of success )


Repeated for each error in devices specified in the axis bitmask, that are also connected.
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Device id
Type: UInt16
Errorcode
Type: UInt16
Timestamp
Type: UInt32
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success See Axis bitmask 0x1000 : General Error
0x1001 : Emergency Stop
0x2311 : Error Continuous Over Current
0x2320 : Error Over Current
0x3210 : Error Overvoltage DC Link
0x3220 : Error Undervoltage DC Link
0x4210 : Error Overtemperature Motor
0x4310 : Error Overtemperature Drive
0x5113 : Error Undervoltage internal 5V Supply
0x5114 : Error Feedback
0x5115 : Error Overspeed
0x8611 : Error Following Window
0x8620 : Error Negative Limit Switch
0x8621 : Error Positive Limit Switch
0x8622 : Error Soft Limit Switch
0xFF01 : Error Force Sensor
0xFF02 : Error Sync IP Mode
0xFF03 : Error Safety IN1
Unix UTC Timestamp
Seconds since
01.01.1970 00:00:00

Response for GetErrors command ( in case of error )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Unknown Error
0x02 : BadIdOrCommand sent command
0x04 : BadLength 1 byte actual length, 1 byte required length



Go to top

Simulation control

Sim IDs


Sim name Sim id
X-Plane 0x00
Microsoft Flight Simulator X 0x01
Prepar3D 0x02
USB Emulation Mode 0x03


GetSimStatus Request


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Sim Control Command
Type: Int32
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD3 : Simulation control 0x00 : GetSimStatus


Response for GetSimStatus command (in case of succes)


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Selected Simulation (Sim ID)
Type: UInt8
Is Sim Connected
Type: UInt8
Simulation Update Rate
Type: UInt16
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success 0x00 : X-Plane
0x01 : MSFX
0x02 : Prepar3D
0x03 : USB Emulation
0x00 : Disconnected
0x01 : Connected
Updates per second
Undefined if not connected!


SelectSim Request


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Sim Control Command
Type: Int32
Sim ID
Type: UInt8
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD3 : Simulation control 0x01 : SelectSim 0x00 : X-Plane
0x01 : MSFX
0x02 : Prepar3D
0x03 : USB Emulation


Response for SelectSim command (in case of succes)


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success


ConnectSim Request


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Sim Control Command
Type: Int32
IP Address (optional)
Type: UInt8[4]
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD3 : Simulation control 0x02 : ConnectSim OPTIONAL
4 Bytes containing an IPv4 Address.
Example: 127.0.0.1 = byte[]{127,0,0,1}


Response for ConnectSim command


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
WARNING! This command will always return success. Use GetSimStatus command to determine connection state.


DisconnectSim Request


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Sim Control Command
Type: Int32
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD3 : Simulation control 0x03 : DisconnectSim


Response for DisconnectSim command


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
WARNING! This command will always return success. Use GetSimStatus command to determine connection state.


Response for all Simulation commands in case of error


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Unknown Error
0x02 : BadIdOrCommand sent command
0x04 : BadLength 1 byte actual length, 1 byte required length
0x06 : InvalidSimState
(The command can not be executed in the current connection state)



Go to top

Settings control

Setting IDs


Setting name Setting id Value type ( Range ) Description
Force profile 0x10 Uint16[9] ( 5..99999 ) Defines a force profile for the axis. Values have to be bigger than 0. Equivalent to the force values in the axis forces tab of the profile manager. This field should be updated as little as possible during flight, as it slows the update rate down.
Force scale factor 0x20 Uint16 ( 20..999 ) Percent value, Scales the force profile. Use this to dynamically change forces on the axis.
Friction value 0x25 Uint16 ( 0..65535 ) Friction value in internal units.
Friction value eng 0x26 float (range not defined) Friction value in engineering units (N for linear motion, Nm for rotational motion).
Position Window 0x27 UInt32 (range not defined) Position window in raw increments. Device specific. In CanOpenCommander (downloadable from Website), open "Control Loading Setup" in device tree, go to tab "Force Profile" and check the Position factor below the diagram to see how much travel per increment you have.
Target Torque 0x28 Int16 (0 - 65535) Target torque in internal force units. Device specific.
Profile mode 0x30 Uint8 ( 0..1 ) Boolean value, defines if all 9 values of the force profile will be used. When the value is 0, the first value of the force profile will be used for the whole range of the axis.
Move back enable 0x40 Uint8 ( 0..1 ) Boolean value, defines if axis wants to go back to its center. When the value is 0, the force profile will be used as friction values.
Autopilot force 0x50 Uint16 ( 5..99999 ) Defines the force the autopilot will use to reach its target position. If this force is too low, the autopilot will not move or move slower than set maximum speed. If the user blocks the autopilot from reaching its target, the autopilot will resist with this amount of force. For finding the best value, start with 1500 and gradually decrease by 100.
Autopilot speed 0x60 Uint16 ( 5..9999 ) Defines the maximum speed at which the autopilot moves to its target position. If Autopilot force (0x50) is too low, the autopilot will not move or move slower than set maximum speed. For finding the best value, start with small values ( < 10 ) and increase gradually.
Autopilot enable 0x70 Uint8 ( 0..1 ) Turns on/off the autopilot. When set to 1, the Autopilot will continuously move the axis to its target position (Autopilot position) with the configured strength and speed.
Autopilot position 0x80 float (-1..1) Normalized value, defines the target position of the autopilot.
Trim position 0x90 float (-1..1) Normalized value, defines the position, the axis wants to go back to, if "move back" is enabled.
Virtual force enable 0xA0 Uint8 ( 0..1 ) Turns on/off the reading of the virtual force. When on, the data id 0x50 can be read to obtain simulated deflection force information.
Override Position 0xB0 Int32 ( Device specific range. ) Writing to this field will override the current position.
This can be used to calibrate devices, who do not have a distinct start position.
Do NOT use this command without understanding its implications.
Using this command undermines several safety features of the drive and may cause damage to material or personnel.
VibrationActive 0xC0 Uint8 ( 0..1 ) Turns on/off vibrations on / off. Enables vibration for the following commands. There are 2 vibration settings. A fast and a slow one. They can be overlaid. If one of the 2 vibrations aren't used, the corresponding force setting can be set to 0. If both vibrations are not used, this setting must be set to 0 again.
You need to set the vibration override on the axes you want to use this feature, even If you use the remote interface without a simulation! (See Override control)
Vibration Speed for fast vibrations. 0xC1 UInt32 (Device specific range) Vibration interval in milliseconds. The lower the value, the faster the vibration.
You need to set the vibration override on the axes you want to use this feature on! (See Override control)
Vibration Force for fast vibrations. 0xC2 UInt32 (Device specific range. (Force limit / 2) ) Vibration force in internal force units. (The possible max value is half the limit of the force profile diagram)
You need to set the vibration override on the axes you want to use this feature on! (See Override control)
Vibration Speed for slow vibrations. 0xC3 UInt32 (Device specific range. (Minimum value is 10) ) Vibration interval in milliseconds. The lower the value, the faster the vibration.
You need to set the vibration override on the axes you want to use this feature on! (See Override control)
Vibration Force for slow vibrations. 0xC4 UInt32 (Device specific range. (Force limit / 2) ) Vibration force in internal force units. (The possible max value is half the limit of the force profile diagram)
You need to set the vibration override on the axes you want to use this feature on! (See Override control)
Force offset 0xD0 Int32 (Device specific range. (Force limit / 2) ) Active force into the specified direction (+/-). You need to set the vibration override on the axes you want to use this feature on! (See Override control)
Toggle feedback for Force offset 0xD1 UInt8 (Boolean: 0 / 1)
Default: 1
This setting will be lost on device state change and therefore has to be set after each device initialization.
If this setting is set to 1, force that has been set through force offset will be reflected in the Data ids 0x20 and 0x21 (Applied force)
If set to 0, force offset applied by user will not be visible in read out force, so only user input will show up in the applied force.
P Force Numerator & Denumerator 0xD2 Int16[2] (Fraction, ex: 1/20)
Int16[0] = Numerator
Int16[1] = Denumerator
This setting will be lost on device state change and therefore has to be set after each device initialization.
Sets the force P factor of the axis as a fraction. The value inversely affects dampening (smaller values increase dampening).

Do NOT use this command without understanding its implications.
Increasing the value may destabilize the axis!

Test with small increments and with the force profile and the scale factor set to the maximal values you want to use. Move the axis to give an impulse and check that the axis does not begin to oscillate.
P Move back 0xD3 UInt32
(0 - 530)
This setting will be lost on device state change and therefore has to be set after each device initialization.
Sets the P Move back factor of the axis. The value affects spring force (bigger values increase the spring force).

Do NOT use this command without understanding its implications.
Increasing the value may destabilize the axis!

Test with small increments and with the force profile and the scale factor set to the maximal values you want to use. Move the axis to give an impulse and check that the axis does not begin to oscillate.
Trim Step 0xD4 UInt16
(0 - 65535)
This setting will be lost on device state change and therefore has to be set after each device initialization.
Sets how close the axis tries to get to the trim position.
Trim Ramp 0xD5 Int16
(1 - 20)
This setting will be lost on device state change and therefore has to be set after each device initialization.
Sets how fast the axis tries to reach the Trim positision.
Extended Force Profile 0xE0 array[18] of struct {
 UInt16 force value;
 Int32 position
}
= 18 * 6 bytes
This setting will be lost on device state change and therefore has to be set after each device initialization.
The extended force profile allows setting an asymetric force profile with 9 values for each side.Index 0 is the first negative value from the center, while index 8 is the negative axis limit. Index 9 is the first positive value from the center while index 17 is the positive axis limit. The position field allows the alignment of these 18 points along the axis range. the units for position are the same internal units as when reading "Axis position raw".
Extended Friction Profile 0xE1 array[18] of struct {
 UInt16 friction value;
 Int32 position
}
= 18 * 6 bytes
This setting will be lost on device state change and therefore has to be set after each device initialization.
The extended friciton profile allows setting an asymetric friction profile with 9 values for each side. Index 0 is the negative axis limit, while index 17 is the positive axis limit. The position field allows the alignment of these 18 points along the axis range. the units for position are the same internal units as when reading "Axis position raw".
Friction by velocity 0xE2 Float[2] (Factor, Limit)
Float[0] = Factor
Float[1] = Limit
This setting will be lost on device state change and therefore has to be set after each device initialization.
The friction by velocity setting allows settings velocity controlled friction using the formula:
Rotational axes: deg/s * Factor = Nm
Translational axes: mm/s * Factor = N
The Limit value defines an upper limit for the friction force in N or Nm.
Axis range limits 0x95 Int32[2] (lower, upper)
Int32[0] = negative limit
Int32[1] = positive limit
Limits the travel range of the axis to a user defined range. The maximum allowed range can be read with the corresponding GetData command "Axis range limits".


Request for writing setting


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Axis
Type: Int32
Setting id
Type: Int32
Setting value
Type: setting specific
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xCE : Settings control 0x00000001 : Elevator
0x00000002 : Aileron
0x00000004 : Rudder
0x00000008 : Collective
0x00000010 : Brake left
0x00000020 : Brake right
0x00000040 : Elevator Trim Wheel
0x00000080 : Aileron Trim Wheel
0x00000100 : Rudder Trim Wheel
0x00000200 : Throttle 1
0x00000400 : Throttle 2
0x00000800 : Throttle 3
0x00001000 : Throttle 4
0x00002000 : Speedbrake
0x00004000 : Nosewheel
0x10 : Force profile
0x20 : Force scale factor
0x25 : Friction value
0x26 : Friction value eng
0x27 : Position Window
0x28 : Target Torque
0x30 : Profile mode
0x40 : Move back enable
0x50 : Autopilot force
0x60 : Autopilot speed
0x70 : Autopilot enable
0x80 : Autopilot position
0x90 : Trim position
0xA0 : Virtual force enable
0xB0 : Override position
0xC0 : Vibration active
0xC1 : Vibration speed fast
0xC2 : Vibration force fast
0xC3 : Vibration speed slow
0xC4 : Vibration force slow
0xD0 : Force offset
0xD1 : Toggle feedback for Force offset
0xD2 : P Force Numerator & Denumerator
0xD3 : P Move back
0xD4 : Trim Step
0xD5 : Trim Ramp
0xE0 : Extended Force Profile
0xE1 : Extended Friction Profile
0xE2 : Friction by velocity
0x95 : Axis range limits
See Setting id table


Response for writing setting


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Unknown Error
0x02 : BadIdOrCommand sent id
0x03 : BadArgumentLength 1 byte actual length, 1 byte required length
0x04 : BadLength 1 byte actual length, 1 byte required length



Go to top

Profile control



Request for SetProfile command


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
ProfileCommand
Type: Int32
Profilename length
Type: UInt8
Profilename
Type: char[]
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xCF : ProfileControl 0x01 : ChangeProfile Length of Profilename without zero terminator Profilename without zero terminator


Response for SetProfile command


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Unknown Error
0x04 : BadLength 1 byte actual length, 1 byte required length
0x05 : InvalidProfileName sent profile name


Request for ListProfiles command


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
ProfileCommand
Type: Int32
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xCF : ProfileControl 0x02 : ChangeProfile


Response for ListProfiles command


Repeated for each profile
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
ProfileCount
Type: UInt16
ProfileNameLength
Type: UInt8
Profile string
Type: char[]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success Number of profiles Length of profile string profile string
(without zero terminator)


Request for GetActiveProfile command


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
ProfileCommand
Type: Int32
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xCF : ProfileControl 0x03 : GetActiveProfile


Response for GetActiveProfile command


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
ProfileNameLength
Type: UInt8
Profile string
Type: char[]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success Length of profile string profile string
(without zero terminator)



Go to top

Input control

Button actions, that can be mapped in CLS2Sim can also be triggered over the remote protocol.
The SetDigitalInputs command below allows setting the digital inputs over the remote inteface.
The behavior is like a bitmask. Actions that are sent in the command will be 'pulled high' or active.
Actions that are not included in the request will be 'pulled low' or inactive.
So if you want to enable the autopilot, you will send 2 packets.
The first contains the id 9003.
The second should arrive about 100ms later, to give CLS2Sim enough time to update the value in the simulation.
Of course you can send other SetDigitalInputs requests in between, but please note that you will
have to include the id 9003 on all SetDigitalInputs packets during that 100ms to keep the 'input' high.

Input Ids

Run CLS2Sim.exe -dumpactions
In the same folder as CLS2Sim.exe the file "ACTION_IDS_DUMP.txt" will be created and the application will close again.
This file contains all possible actions ids. Please be aware that not all action ids are supported for all actions.

Here are the most common action ids:
NameIdSupported ion X-PlaneSupported in MSFX/Prepar3D
AP - Disable autopilot (CMD) 9001 X X
AP - Activate Flight director 9002 X X
AP - Enable autopilot 9003 X X
AP - Control Wheel Steering 9004 X X
AP - Take off go around 9005 X
Trim - elevator up 1002 X X
Trim - elevator down 1003 X X
Trim - aileron left 1004 X
Trim - aileron right 1005 X
Flaps up 1026 X X
Flaps down 1027 X X
View - Look forward 1100 X
View - Look up 1107 X
View - Look down 1108 X
View - Look left 1109 X
View - Look right 1110 X
View - Glance left 1111 X
View - Glance right 1112 X
Radio - Contact ATC 1120 X




Request for SetDigitalInputs command


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Input Ids
Type: UInt16[]
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD5 : InputControl Array of Input Ids to be high
All unsent Ids are pulled low.


Response for SetDigitalInputs command


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Invalid input Ids
Type: UInt16[]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success 0x02 : BadIdOrCommand In case of error:
All input ids that are invalid



Go to top

Input interdiction control

All digital and analog actions that are transmitted to the connection simulation, can be interdicted, to simulate failure conditions or similar.
The SetInterdictedInputIds defines which ids are currently interdicted. Any previousely interdicted id, will be released if it is not in the next packet.
The behavior is like a bitmask. Ids that are sent in the command will be interdicted.
Ids that are not included in the request will will have their interdiction removed if previously interdicted.
So if you want to disable any buttons mapped in CLS2Sim that enable autopilot, you will send a packet containing the id 9003.
Later on, to remove the interdiction for that specific action, you would send another packet, which does NOT contain 9003.
Of course you can send other SetInterdictedInputIds requests in between, but please note that you will
have to include the id 9003 on all SetInterdictedInputIds packets during that time to keep the action 'enable autopilot' interdicted.

Input Ids

Run CLS2Sim.exe -dumpactions
In the same folder as CLS2Sim.exe the file "ACTION_IDS_DUMP.txt" will be created and the application will close again.
This file contains all possible actions ids. Please be aware that not all action ids are supported for all actions.


Request for SetInterdictedInputIds command


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Input Ids
Type: UInt16[]
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD11 : InputInterdictionControl Array of Input Ids to be interdicted
All unsent Ids are cleared of interdiction.


Response for SetInterdictedInputIds command


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Invalid input Ids
Type: UInt16[]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success 0x02 : BadIdOrCommand In case of error:
All input ids that are invalid



Go to top

Reading data

In a dual-seat set-up, all Data except force information and buttons is synchronized. Commands will send data for each connected device, but will limit the selection to the chosen axes. In a dual seat, data for pilot and copilot devices is returned. See device id's at the top.

Data IDs


Data name Data id Value type ( Range ) Description
Axis position 0x10 Int16 ( -32767 - 32767 )
Brakes: UInt16 ( 0 - 65535 )
Position of the Axis. Brakes and Throttle is handled differently as these axes have no negative range.
Axis position normalized 0x11 Float (-1.0 - 1.0)
Brakes: Float ( 0.0 - 1.0 )
Position of the Axis, normalized. Brakes and Throttle is handled differently as these axes have no negative range.
Axis position raw 0x12 Int32 (undefined range)
Position of the Axis as raw value. Different ranges per device type and axis.
Applied force 0x20 Int16 ( -32767 - 32767 ) The force applied to the axis. Force reading for brakes is deactivated until further notice.
Applied force, normalized 0x21 Float ( -1.0 - 1.0 ) The force applied to the axis, normalized. If force reaches 1, the device will throw a force sensor error. Force reading for brakes is deactivated until further notice.
Digital inputs followed by calibrated Analog Values.
Must not be used in external control mode!

Will not group analog inputs per device ID!
0x32 This command will always return data for all device ids selected through the requests axis bitmask.
Devices that are not connected will return zero for the number of digital inputs and the number of analog inputs will lower accordingly.
If you need to assign specific analog inputs to specific devices, use the "Analog inputs (0x40)" Data Id.
The first part of the reponse data is exactly the same as Digital inputs extended.
Each device id selected using the axis bitmask in the request will return its id and number of digital inputs, followed by the byte array with the DIn bits. After that there will be ONE block of analog input data, where all analog inputs of all connected devices are grouped together, ordered by device id, then analog input number.
Response
Repeated for each device id selected via axis bitmask
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Device id
Type: UInt16
DIn count
Type: UInt16
Digital inputs
Type: Byte[DIn count]
AIn count
Type: UInt16
Analog inputs
Type: UInt32[AIn count]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success See Axis Bitmask. Number of digital inputs
for this device id.
Bitfield padded to
the nearest Byte.
Number of Analog inputs
for ALL connected devices
UInt32 array containing all analog inputs connected to the CAN bus.

Digital inputs followed by uncalibrated Analog Values. 0x34 This command will always return data for all device ids selected through the requests axis bitmask.
Devices that are not currently connected will return zero for the number of digital inputs and the number of analog inputs
Each device id selected using the axis bitmask in the request will return its id and number of digital inputs, followed by a bitfield containing the inputs, padded to the nearest byte. After that will be the number of analog inputs followed by a UInt32 array with the analog values.
Response
Repeated for each device id selected via axis bitmask
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Device id
Type: UInt16
DIn count
Type: UInt16
Digital inputs
Type: Byte[DIn count]
AIn count
Type: UInt16
Analog inputs
Type: UInt32[AIn count]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success See Axis Bitmask. Number of digital inputs
for this device id.
Bitfield padded to
the nearest Byte.
Number of Analog inputs
for this device id.
UInt32 array containing all analog inputs of this device.

Digital inputs followed by uncalibrated analog values, followed by encoder values. 0x35 This command will always return data for all device ids selected through the requests axis bitmask.
Devices that are not currently connected will return zero for the number of digital inputs and the number of analog inputs
Each device id selected using the axis bitmask in the request will return its id and number of digital inputs, followed by a bitfield containing the inputs, padded to the nearest byte. After that will be the number of analog inputs followed by a UInt32 array with the analog values.
After that will be the number of encoder inputs followed by a UInt16 array with the encoder values.
Response
Repeated for each device id selected via axis bitmask
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Device id
Type: UInt16
DIn count
Type: UInt16
Digital inputs
Type: Byte[DIn count]
AIn count
Type: UInt16
Analog inputs
Type: UInt32[AIn count]
EncIn count
Type: UInt16
Encoder inputs
Type: UInt16[EncIn count]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success See Axis Bitmask. Number of digital inputs
for this device id.
Bitfield padded to
the nearest Byte.
Number of Analog inputs
for this device id.
UInt32 array containing all analog inputs of this device. Number of Encoder inputs
for this device id.
UInt16 array containing all encoder inputs of this device.

Analog inputs 0x40 UInt16 number of analog inputs
UInt32[] analog input value
All analog inputs of the device id. Input values are NOT normalized.
Virtual force 0x50 UInt32 (Device specific range)
If virtual force has been enabled for this axis (Set setting value 0xA0 to 1), this data will show the simulated deflection force for this axis.
Axis Range limits 0x60 For each selected device id:
struct {
 UInt16 device ID;
 Int32 MinLowerLimit;
 Int32 MaxUpperLimit;
 Int32 CurrentLowerLimit;
 Int32 CurrentUpperLimit;
}
Returns the total available range for each device id of the selected axes. Can be used as min and max value when using the SettingsCommand "Axis Range Limits".


Request for reading data


Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Axis
Type: UInt32
Data id
Type: UInt32
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD0 : Read data 0x00000001 : Elevator
0x00000002 : Aileron
0x00000004 : Rudder
0x00000008 : Collective
0x00000010 : Brake left
0x00000020 : Brake right
0x00000040 : Elevator Trim Wheel
0x00000080 : Aileron Trim Wheel
0x00000100 : Rudder Trim Wheel
0x00000200 : Throttle 1
0x00000400 : Throttle 2
0x00000800 : Throttle 3
0x00001000 : Throttle 4
0x00002000 : Speedbrake
0x00004000 : Nosewheel
0x10 : Axis position
0x11 : Axis position normalized
0x20 : Applied force
0x21 : Applied force normalized
0x30 : Digital inputs (eg. buttons)
0x40 : Analog inputs (eg. brakes)
0x50 : Virtual force
0x60 : Axis Range limits


Response for reading data ( in case of success )


Repeated for each device id
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Device id
Type: UInt16
Data
Type: Type specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success See Axis Bitmask See Data Id table


Response for reading data ( in case of error )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x01 : Unknown Error
0x02 : BadIdOrCommand sent command
0x04 : BadLength 1 byte actual length, 1 byte required length



Go to top

Reading/Writing IO2CAN Gateway data

Request for reading IO2CAN Gateway data


Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Device ID's
Type: Byte[]
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD2 : Read IO2CAN Gateway data Any number of bytes.
Each byte is a device id as shown in Profilemanager - > Buttons / Analog inputs


Response for reading IO2CAN Gateway data ( in case of success )


Repeated for each device id
Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Device id
Type: UInt16
Num DIn
Type: Byte
Num AIn
Type: Byte
Din bitmask
Type: byte[num digital inputs / 8]
Analog inputs
Type: UInt16[num analog inputs]
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success Device id as shown in
Profilemanager - > Buttons / Analog inputs
Number of digital inputs. Number of analog inputs. Digital inputs bitmask consisting of ceil([Num Din] / 8) bytes Analog input values.


Response for reading IO2CAN Gateway data ( in case of error )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x01 : Unknown Error
0x02 : BadIdOrCommand sent command


Request for writing IO2CAN Gateway outputs


Repeated for each device id
Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Device ID
Type: Byte
Output bitmask
Type: Byte
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD6 : Set IO2CAN Gateway outputs Device id as shown in
Profilemanager - > Buttons / Analog inputs
Bitmask that controls ouput 0 to 3 using the lowest 4 bits.


Response for writing IO2CAN Gateway outputs ( in case of success )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success


Response for writing IO2CAN Gateway outputs ( in case of error )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Type: UInt8
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x02 : Id of a not existing or connected IODevice was used Nonexisting device Id






Go to top

Setting IO2CAN Gateway output communication timeout

For the IO2Can Gateway outputs a watchdog can be activated. If the timeout is not set to 0, the watchdog is active.
If the IO2Can device does not receive CAN packets for the set duration, all outputs will be set to low.
This allows a connected hardware to react, if the control software controlling the IO2Can device crashes.
To deactivate the setting again, set it to 0.

Request for setting IO2CAN Gateway output communication timeout


Repeated for each device id
Message Identifier(optional)
Type: UInt32
Command
Type: UInt32
Device ID
Type: Byte
Timeout
Type: UInt16
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD7 : Set IO2CAN Gateway output communication timeout Device id as shown in
Profilemanager - > Buttons / Analog inputs
Timeout in milliseconds


Response for writing IO2CAN Gateway outputs ( in case of success )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success


Response for writing IO2CAN Gateway outputs ( in case of error )


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Type: UInt8
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x02 : Id of a not existing or connected IODevice was used Nonexisting device Id



Go to top

Override control

When using the remote interface in combination with a supported simulation, trim, force and autopilot will be controlled by the simulation. To control these features over the remote interface, overrides have to be set active. The following command allows setting this for any axis. The settings that need an override are "Force scale factor", "Autopilot enable", "Autopilot position" and "Trim position". For details on those, read "Settings control" further up.

Setting an override is done by specifying for which axes this override is active. Each axis bit defined in the axis field will set the override for that axis. Axes that are not included in the Axis field will be unset.

To disable all overrides, pass zero for the axis field.

Override IDs


Override name Override id Description
Scale factor override 0x01 Allows overriding the force scale factor, which is normally calculated from force factor and current airspeed.
Trim position override 0x02 Allows overriding the trim position.
Autopilot enable override 0x03 Allows overriding the state (on/off) of the autopilot in the hardware.
Autopilot position override 0x04 Allows overriding the target position of the hardware autopilot.
Vibration override 0x05 Allows overriding the vibration settings of the hardware.
To manipulate vibrations, or the force offset, this command needs to be applied, even if no simulation is connected.
Take care when setting vibrations!
Start with a force of 50 and work you way up in increments of 100
to get a feel for the strength of vibrations or force offset.
Position override 0x06 Axis Positions will not be sent to simulation.


Request for writing override


Message Identifier(optional)
Type: UInt32
Command
Type: Int32
Axis
Type: Int32
Override id
Type: Int32
This field only is active,
if enabled in the Menu "File" > "Settings"

Choose arbitrary value.
Response will have same value.
0xD1 : Override control 0x00000001 : Elevator
0x00000002 : Aileron
0x00000004 : Rudder
0x00000008 : Collective
0x00000010 : Brake left
0x00000020 : Brake right
0x00000040 : Elevator Trim Wheel
0x00000080 : Aileron Trim Wheel
0x00000100 : Rudder Trim Wheel
0x00000200 : Throttle 1
0x00000400 : Throttle 2
0x00000800 : Throttle 3
0x00001000 : Throttle 4
0x00002000 : Speedbrake
0x00004000 : Nosewheel
0x00000001 : Force scale factor override
0x00000002 : Trim position override
0x00000003 : Autopilot enable override
0x00000004 : Autopilot position override
0x00000005 : Vibrations override
0x00000006 : Positions override


Response for writing setting


Packetlength
Type: UInt16
Message Identifier(optional)
Type: UInt32
Status
Type: UInt8
StatusArguments
Status value specific
Length of the
rest of the packet
This field only is active,
if enabled in the Menu "File" > "Settings"

Response will have same value as sent request.
0x00 : Success
0x01 : Unknown Error
0x02 : BadIdOrCommand sent id
0x04 : BadLength 1 byte actual length, 1 byte required length




©2024 Brunner Elektronik AG
CH-8335 Hittnau 
http://www.brunner-innovation.swiss