Host Force Feedback Condition Force Host Force Feedback Externally-Triggered Condition Force navigation bar

Table of Contents

Host Force Feedback Condition Torque

Produces a condition torque effect on a game controller on the host.

Library

QUARC Targets/Devices/Peripherals/Host/Force Feedback Game Controllers/Condition Force Effects

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Devices/Peripherals/Host/Force Feedback Game Controllers/Condition Force Effects')

Description

Host Force Feedback Condition Torque

The Host Force Feedback Condition Torque block produces a condition torque on the host game controller. Condition torque effects are closed-loop effects that vary according to the "condition" or state of the device, such as its angular position, velocity or acceleration. The condition torque may take the form of a spring, damper, inertia or friction.

Each condition is based on a different "metric". The spring effect uses angular position as its metric, so the torque increases in proportion to the rotation of the axis from a defined neutral point. The damper effect uses angular velocity as its metric, so the torque increases in proportion to the angular velocity with which the user moves the axis. The inertia effect is based on the metric of angular acceleration, so the torque increases in proportion to the angular acceleration of the axis. Finally, the friction effect is applied when the axis is moved and depends on the defined friction coefficient. In general, excluding saturation, the resulting torque is equal to:

negative coefficient * (metric - (offset - deadband))

when the metric is less than offset - deadband, and is equal to:

positive coefficient * (metric - (offset + deadband))

when the metric is greater than offset + deadband.

The Tx, Ty and Tz inputs define a torque vector whose direction determines the direction of the condition torque applied by the game controller when the offset through dead inputs are scalars. For example, if the Tx and Ty inputs are connected and equal to 1, then a friction effect would resist angular motion about a northwest-southeast axis but would have no effect on the game controller motion about the northeast-southwest axis. The amplitude and direction of this torque are updated every sampling instant according to the inputs to the block.

If one of the offset through dead inputs is not a scalar, but is a vector whose length equals the number of axes for the effect, then the direction is not determined by the Tx, Ty and Tz inputs. Instead, a separate condition torque effect is applied about each axis independently, with the elements of the offset through dead input vectors applying to the corresponding axes. The axes are determined by which of the Tx, Ty and Tz inputs are connected. For example, if the Tx and Tz inputs are connected, but not the Ty input, and the offset through dead inputs are 2-vectors, then the first element of each 2-vector is applied to a condition torque effect about the X axis, and the second element to a separate condition torque effect about the Z axis. If some of the inputs are scalars, but not all, then the scalar value is applied to all the torque effect axes as if the value were expanded into a vector of the appropriate length.

A Host Force Feedback Game Controller block must be present in the model to configure the game controller.

Limitations

Unused axes

Warning Unused axes should be left unconnected or connected to the

Ground

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc('Ground')
block. Do not connect unused axes to any other type of block because doing so will require a game controller with all the connected axes. For example, if the Tx, Ty and Tz inputs are all connected then the game controller will need to support all three axes in order for the effect to be rendered.

Level of support

Warning Not all force feedback game controllers will support the condition torque effect. If condition torque effects are supported, a game controller may not support all the axes or features of this block.

Conditionally-executed subsystems

Warning Force effects are downloaded to the device and implemented by the device itself. Hence, placing this blocking in a conditionally-executed subsystem does not disable the effect when the subsystem is not being executed. Instead of using a conditionally-executed subsystem, set the amplitude of the torque to zero or use a Host Force Feedback Externally-Triggered Condition Torque block for this purpose.

MATLAB/Simulink R2010a Support

Warning Note that the Host Force Feedback Condition Torque block available in this build of QUARC 2.1 does not currently support MATLAB/Simulink R2010a. Quanser is currently working on a solution to not only have this block work with MATLAB/Simulink R2010a but also greatly improve its overall performance and capabilities.

Input Ports

Tx

The X component of the direction of the applied torque. The positive X direction is from left to right. If this axis is unused, connect it to a

Ground

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc('Ground')
block or leave it unconnected. If one or more of the offset through dead inputs is a vector then the value of this input is not used. However, the fact that it is connected, in this case, indicates that a condition torque effect should be applied to the X axis

Ty

The Y component of the direction of the applied torque. The positive Y direction is from back to front. If this axis is unused, connect it to a

Ground

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc('Ground')
block or leave it unconnected. If one or more of the offset through dead inputs is a vector then the value of this input is not used. However, the fact that it is connected, in this case, indicates that a condition torque effect should be applied to the Y axis

Tz

The Z component of the direction of the applied torque. The positive Z direction is from up to down. If this axis is unused, connect it to a

Ground

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc('Ground')
block or leave it unconnected. If one or more of the offset through dead inputs is a vector then the value of this input is not used. However, the fact that it is connected, in this case, indicates that a condition torque effect should be applied to the Z axis

offset

The offset by which to bias the metric used to produce the condition effect. For a spring effect, the angular position at which the spring would be considered at rest is defined by the offset. For a damper, the offset defines the angular velocity for which the damping torque is zero. The offset is not normally used for the inertia or friction effects. See the formulae in the block description above for more details.

+coeff

The proportionality factor that scales the effect with the metric in the positive direction. For the spring effect, it is the spring constant in Hooke's Law. For the damper effect, it is the damping coefficient and for the inertia effect, it is the coefficient applied to angular acceleration. For the friction effect, it is the coefficient of friction.

For some devices, you can set separate coefficients for the positive and negative direction about the axis associated with the condition. For example, a steering wheel controlling a damaged vehicle might move more easily clockwise than counterclockwise. If separate coefficients are supported, then this coefficient is applied to the positive direction. Otherwise this coefficient is used for both the positive and negative directions. See the formulae in the block description above for more details.

-coeff

The proportionality factor that scales the effect with the metric in the negative direction. For the spring effect, it is the spring constant in Hooke's Law. For the damper effect, it is the damping coefficient and for the inertia effect, it is the coefficient applied to angular acceleration. For the friction effect, it is the coefficient of friction.

For some devices, you can set separate coefficients for the positive and negative direction along the axis associated with the condition. For example, a steering wheel controlling a damaged vehicle might move more easily clockwise than counterclockwise. If separate coefficients are supported, then this coefficient is applied to the negative direction. Otherwise this coefficient is ignored and the +coeff input is used for both the positive and negative directions. See the formulae in the block description above for more details.

+sat

In force feedback, saturation is an expression of the maximum possible torque for an effect. For example, suppose a steering wheel has a spring condition about the Y axis. If the offset is 0 and the coefficient is 1 then the maximum torque is exerted when the wheel is rotated fully. But if you define a positive and negative saturation of 0.5 then the torque does not increase after the wheel has been rotated halfway clockwise or counterclockwise. This input is used to specify the saturation in the positive direction. If the device does not support positive and negative saturation limits then this value is applied to both the positive and negative directions. See the formulae in the block description above for more details.

-sat

In force feedback, saturation is an expression of the maximum possible torque for an effect. For example, suppose a steering wheel has a spring condition about the Y axis. If the offset is 0 and the coefficient is 1 then the maximum torque is exerted when the wheel is rotated fully. But if you define a positive and negative saturation of 0.5 then the torque does not increase after the wheel has been rotated halfway clockwise or counterclockwise. This input is used to specify the saturation in the negative direction. If the device does not support positive and negative saturation limits then this value is ignored and the +sat input is applied to both the positive and negative directions. See the formulae in the block description above for more details.

dead

The deadband is an angular zone around the offset of an axis within which the condition is not active. In the case of a spring that is at rest at a particular angular position, the deadband enlarges this area of rest. See the formulae in the block description above for more details.

Output Ports

This block has no output ports.

Parameters and Dialog Box

Host Force Feedback Condition Torque

Controller name

The identity of the associated Host Force Feedback Game Controller block. The Host Force Feedback Condition Torque block must be associated with a Host Force Feedback Game Controller block.

Effect type (tunable offline)

The type of condition effect to generate. The supported types are spring, damper, inertia and friction.

Effect gain (tunable online)

A normalized gain to apply to the effect. The torques are scaled by this gain before being applied to the device. The gain must be a fraction between 0 and 1 inclusive. This parameter is useful for scaling effects for a different game controller.

Effect sampling period (tunable online)

The sampling period of the effect in seconds. This parameter determines the sampling period of the effect on the device itself. It is not related to the sample time of this block. It is the period at which the magnitude of the effect is updated by the device. If this value is zero, the default sampling period is used.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time from its inputs.

To use the fundamental sampling time of the model, set the sample time to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model.

The default sample time is set to -1 because this block typically inherits its sample time from its inputs.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar