Start of trail Sigmoid navigation bar

Table of Contents

Continuous Sigmoid

Generates a sigmoid trajectory from the current position (and velocity) to the target position. Position, velocity and acceleration profiles are generated, as well as a signal to indicate when the trajectory has reached the target. Trajectories are recomputed whenever the target position or maximum velocity or acceleration limits change.

Library

QUARC Targets/Sources/Sigmoids

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/Sources/Sigmoids')

Description

Continuous Sigmoid

The Continuous Sigmoid block generates a smooth trajectory from the current position (and velocity) to the target position. The velocity at the target position will be zero. It uses the specified maximum velocity and acceleration to derive the fastest possible trajectory from the current position to the target position. The current position and velocity are determined by the current trajectory and the current time. The initial position and velocity (when the model is started) may be specified as parameters. The initial velocity must be no greater than the maximum velocity.

The Continuous Sigmoid block samples its inputs at regular intervals, determined by the Input Sample Time parameter. Each time the inputs are sampled and one of the inputs has changed, the trajectory is re-computed. Hence, the sample time should normally be slower than the time taken to traverse the trajectory.

The output of the Continuous Sigmoid block is generated using the sampling rate specified by the Output Sample Time parameter. The Output Sample Time may be set to zero for a continuous-time trajectory.

The Continuous Sigmoid block provides the Done signal to indicate when the trajectory reaches its target. A Hold-Off time can also be specified to wait a certain amount of time after reaching the target before asserting the Done signal. This output may be used to trigger another event, or reset encoder counts, for example.

The block supports vector signals, in which case it will produce a separate sigmoid trajectory for each element. The Maximum Velocity, Maximum Acceleration, Initial Position, Initial Velocity and Hold-Off parameters may be vectors in this case.

Input Ports

xd

The current target position for the trajectory. If this input changes then the trajectory is re-computed. The input is sampled at the sampling rate specified by the Input Sample Time parameter.

vmax

This port appears when the Source of parameters is set to External(input ports), and provides the maximum velocity that will be allowed in the trajectory. The output trajectory will never exceed the specified maximum velocity. If this input changes, the trajectory is re-computed.

amax

This port appears when the Source of parameters is set to External(input ports), and provides the maximum acceleration that will be produced in the trajectory. The output trajectory will never exceed the specified maximum acceleration. If this input changes, the trajectory is re-computed.

Output Ports

x

The position profile. It is a smooth trajectory going from the initial position to the target position.

v

The velocity profile. It is a continuous curve going from the initial velocity to zero. The velocity is computed independently of the position - it is not computed via a numerical derivative of the position.

a

The acceleration profile. Due to the nature of the sigmoid trajectory, the acceleration curve is discontinuous. Like the velocity, it is also computed independently of the position rather than by numerical differentiation.

Done

A signal indicating when the trajectory is complete. The signal is zero until the target position is reached. After reaching the target position, the Continuous Sigmoid block waits for the number of seconds specified in the Hold-Off parameter before setting the Done signal to one.

Data Type Support

This block accepts scalar or vector input of type double. The block outputs are all of type double.

Parameters and Dialog Box

Continuous Sigmoid

Source of parameters

The source of maximum velocity and acceleration is controlled by this field to be Internal (dialog parameters) or External (block inputs).

Maximum Velocity

This parameter is enabled when the Source of parameters is set to Internal(dialog parameters), and provides the maximum velocity that will be allowed in the trajectory. The output trajectory will never exceed the specified maximum velocity. If this parameter is changed, the trajectory is re-computed.

Maximum Acceleration

This parameter is enabled when the Source of parameters is set to Internal(dialog parameters), and provides the maximum acceleration that will be produced in the trajectory. The output trajectory will never exceed the specified maximum acceleration. If this parameter is changed, the trajectory is re-computed.

Initial Position

The initial position. This position is used when the model is started. Once the model is started, the current position is always determined from the current trajectory.

Initial Velocity

The initial velocity. This velocity is used when the model is started. Once the model is started, the current velocity is always determined from the current trajectory.

Hold-Off

The hold-off time is the time between the trajectory reaching its target and the Done signal being asserted. The hold-off time should generally be equal to, or greater than, the Output Sample Time.

The hold-off time is needed when the Done signal is used to trigger other events. Suppose the first trajectory reaches its target and the Done signal is asserted. If for the next trajectory the current position and target position are the same, the Done signal never goes low if the hold-off time is zero because we are already at the target position. In an event-driven system, the fact that Done never goes low means that it will not have a rising edge and will not produce another trigger event.

By specifying a non-zero hold-off time, the Done signal will always go low for at least the hold-off time. Hence, it will always produce a trigger event.

Input Sample Time

The sampling rate of the target position input. This value may be set to -1 to inherit the sampling rate from the target position input signal. Use a value of zero for continuous-time and a positive scalar for a discrete sampling rate.

Output Sample Time

The sampling rate used for the output trajectory. This value may be set to zero for continuous-time or a positive scalar for a discrete sampling rate. The Output Sample Time should always be faster than the Input Sample Time.

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.

 

navigation bar