Contenuto principale

Pilot Joystick All

R2026b

Provide joystick interface in All Outputs configuration

  • Pilot Joystick All block

Libraries:
Aerospace Blockset / Animation / Animation Support Utilities

Alternative Configurations of Pilot Joystick All Block:
Pilot Joystick

Description

The Pilot Joystick All block provides a pilot joystick interface. Roll, pitch, yaw, and throttle are mapped to the joystick X, Y, R, and Z channels respectively.

The Pilot Joystick and Pilot Joystick All blocks are alternative configurations of the same block.

  • Pilot Joystick — Outputs four axes.

  • Pilot Joystick All — Outputs all channels.

Examples

Limitations

  • The Pilot Joystick All block is not supported in Simulink Online.

  • If the joystick does not support an R (rudder or twist) channel, yaw output is set to zero. Outputs are of type double, except when Joystick ID is set to AllOutputs mode, which is a uint32 flagword of bits. On non Microsoft® platforms, this block outputs zeros.

  • Pitch value has the opposite sense as that delivered by the FlightGear joystick interface.

Platform Limitations

  • Microsoft

    • Supports Microsoft Xbox® controllers.

  • Linux®

    • Does not support Microsoft Xbox® controllers.

    • Order of axes outputs are not guaranteed.

    • Joystick IDs might differ or be offset depending on the system. If the block outputs are not as expected, check the joystick IDs.

    • Yaw and throttle might be flipped for some joysticks and game controllers.

  • Mac OS X

    • Does not support Microsoft Xbox® controllers.

Ports

Output

expand all

Analog output.

For Microsoft Windows®, the analog outputs are in this order.

Microsoft Windows Analog Outputs

Array Number

Channel

Output Range

Description

1

lX

[-1, 1]

Roll command

2

lY

[-1, 1]

Pitch command

3

rglSlider[0]

[0, 1]

Throttle

4

Rz

[-1, 1]

Yaw command

5

lZ

[-1, 1]

Z channel value

6

Rx

[-1, 1]

X rotation value

7

Ry

[-1, 1]

Y rotation value

8

rglSlider[1]

[0, 1]

Second slider

For other platforms, the first joystick axes element is x, the second element is y, and so on, up to the total number of axes. What the x-axis represents depends on the type and shape of the joystick. The Pilot Joystick All block uses the mapping between the joystick driver and the joystick.

Data Types: double

Button output, returned as a flagword containing up to 32 button states on the buttons channel. Bit 0 is button 1, Bit 1 is button 2, and so forth.

Data Types: uint32

Point-of-view, returned as a hat value in degrees on the POV channel. Zero degrees is straight ahead, 90 degrees is to the left, and so forth.

When the joystick is centered, this port returns -1.

Data Types: double

Parameters

expand all

Specify the joystick ID as

  • Joystick1

  • Joystick2

  • Joystick3

  • Joystick4

  • Joystick5

  • Joystick6

  • Joystick7

  • Joystick8

  • Joystick9

  • Joystick10

  • Joystick11

  • Joystick12

  • Joystick13

  • Joystick14

  • Joystick15

  • Joystick16

  • None

Programmatic Use

Block Parameter: JoystickID
Type: character vector
Values: Joystick1 | Joystick2 | Joystick3 | Joystick4 | Joystick5 | Joystick6 | Joystick7 | Joystick8 | Joystick9 | Joystick10 | Joystick11 | Joystick12 | Joystick13 | Joystick14 | Joystick15 | Joystick16 | None
Default: 'Joystick1'

Joystick output configuration, specified as FourAxis or AllOutputs.

Programmatic Use

Block Parameter: OutputConfiguration
Type: character vector
Values: FourAxis | AllOutputs
Default: 'FourAxis'

Specify the sample time (-1 for inherited), specified as a scalar.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '1/30'

Joystick error behavior, specified as:

ActionDescription
None Output zeros, model simulation continues.
Warning

Warning in the Diagnostic Viewer, output zeros, model simulation continues.

Error (default)

Error in the Diagnostic Viewer, model simulation stops.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '1/30'

Alternative Configurations

expand all

The Pilot Joystick block outputs four axes.

Libraries:
Aerospace Blockset / Animation / Animation Support Utilities

Version History

Introduced in R2007a

expand all