# Drive behavior

{% hint style="info" %}
**New in realvirtual 6.0.9-beta:**

* **Position Feedback Scale/Offset**: Drive behaviors now support symmetric scale and offset transformations for position feedback, enabling proper closed-loop control with PLCs
* **Scale Feedback Position**: New boolean property to optionally disable scale/offset transformations and receive raw position values
* **Invert Output Logic**: Drive\_Cylinder now supports inverted control logic for normally-closed valve configurations
  {% endhint %}

The Drive Behavior provides a detailed behavior to a [Drive](https://doc.realvirtual.io/components-and-scripts/motion/drive). This gives the flexibility to model all variety of ways to move objects. In realvirtual.io a few standard Drive Behaviors are included and you can extend them based on the components you are using in real life.\
Here is a list of the included Drive Behaviors. All Drive Behaviors are named with a prefix *Drive\_* from better clarification.

## Adding Drive Behaviors

Drive behaviors can be added to a GameObject with a Drive component in two ways:

1. **Add Component Menu**: Select the GameObject with the Drive component, then use *Component > realvirtual > Motion > Drive Behaviors* to choose the desired behavior
2. **QuickEdit Overlay** (Professional): Use the QuickEdit overlay buttons to quickly add drive behaviors directly in the Scene view

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-f86b22b73a2810ae6ac43218d08a28cbf8aa11b3%2Fquickedit-drivebehaviors-2025.png?alt=media" alt=""><figcaption><p>QuickEdit overlay showing drive behavior buttons for quick access</p></figcaption></figure></div>

This tutorial explains the relation between Signals and Behavior Models:

{% embed url="<https://youtu.be/sCKEi-6EKYQ>" %}

### Drive\_Cylinder

This is the model of a simple cylinder movement. The cylinder is defined by a maximum (*MaxPos*) and minimum (*MinPos*) position in millimeters in relation to a zero position. The speed of the cylinder to move in and out is defined by the time in seconds *TimeOut* and *TimeIn*.

**Settings:**

* **One Bit Cylinder**: When enabled, uses single signal for control. Out=false moves cylinder in, Out=true moves cylinder out.
* **Invert Output Logic** (new in 6.0.9-beta): Inverts the control logic. When enabled, Out=false extends the cylinder, Out=true retracts it. Useful for normally-closed valve configurations or inverted signal requirements.
* **Min Pos / Max Pos**: Define the cylinder stroke in millimeters.
* **Time Out / Time In**: Extension and retraction times in seconds.
* **Stop When Driving To Min/Max**: Optional sensors to stop the cylinder before reaching end positions.

The cylinder can be controlled manually by setting the booleans under *Behavior Signals*. Under *PLC IOs* PLC signals can be connected to the cylinder.

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-1c53a96bb7148b85fc6b93ebad28028be5236525%2Fdrive-cylinder-2025.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_Simple <a href="#drive-simple" id="drive-simple"></a>

The Simple Drive is controlled by boolean values for forward and backward movement with configurable speed and acceleration.

**Settings:**

* **Scale Speed**: Scale factor for input/output speed and acceleration values
* **Current Position Scale** (new in 6.0.9-beta): Scale factor for position feedback transformation
* **Current Position Offset** (new in 6.0.9-beta): Offset in millimeters applied to position feedback
* **Scale Feedback Position** (new in 6.0.9-beta): When enabled (default), applies scale and offset to position feedback. Disable to receive raw position values.

The scale and offset enable symmetric transformations for proper closed-loop control: position feedback uses the inverse transformation of position commands.

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-121734e26aeece941e8db2c1fb22716f6da78fba%2Fdrive-simple-2025.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_DestinationMotor

The Destination Motor is a drive controlled by target positions and target speeds. After setting the target speed and target position, the movement can be started by a boolean Signal *StartDrive*. After the drive reaches its target position the Signal *IsAtDestination* is set high.

**Scale/Offset Properties** (new in 6.0.9-beta):

* **Current Position Scale**: Scale factor applied to both position commands and feedback
* **Current Position Offset**: Offset in millimeters applied to both position commands and feedback
* **Scale Feedback Position**: When enabled (default), applies symmetric scale/offset transformations for proper closed-loop control

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-8406b51dc7a467d21bff12bc9a1bc5da612709d0%2Fdrive-destinationmotor-2025.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_FollowPosition <a href="#drive-followposition" id="drive-followposition"></a>

This is the behavior model of a drive where the drive exactly follows the current provided position of the PLC. This is especially useful for connecting motion controllers and robot controllers to realvirtual.

**Settings:**

* **Offset**: Position offset in millimeters added to input signal
* **Scale**: Scale factor applied to position input signal
* **Current Position Scale** (new in 6.0.9-beta): Additional scale factor for position feedback
* **Scale Feedback Position** (new in 6.0.9-beta): When enabled (default), applies symmetric transformation: feedback = ((CurrentPosition - Offset) / Scale) \* CurrentPositionScale

The symmetric transformation ensures that the PLC receives properly scaled feedback values that match the coordinate system of the commanded positions.

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-5fc4667ab48283a962585398ef64c35317f47ce8%2Fdrive-followposition-2025.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_Gear <a href="#drive-gear" id="drive-gear"></a>

This behavior model is useful for connecting two drives together. The master drive will control the position of the drive that the gear is attached to. This is useful for two gripper fingers where only one is controlled by a pneumatic model and the second one follows correspondingly. The formula for the position of a gear controlled drive is: *CurrentPosition = MasterDrive.CurrentPosition x GearFactor + Offset*.

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-cb58008d655b7ded8270b6da5aa805aca31434db%2Fmotion-gear.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_ContinousDestination <a href="#drive-continousdestination" id="drive-continousdestination"></a>

This drive is continuously trying to follow the given destination with the given speed. Unlike *Drive\_FollowPosition*, this Drive is not following exactly the given position because it might need some time to reach the destination. You don't need to set a start signal to start to drive like with *Drive\_DestinationMotor*. This drive is always starting to drive to a different destination as soon as the SignalDestination is changed. Please note, that you need to turn on *UseAccelearation* in the connected drive to use acceleration values.\
This Drive is specially useful for users who are reusing Simit models which are connected to NX Mechatronics Concept Designer. In NX Mechatronics Concept Designer this type of Drive is called *PositionControl*.

**Scale/Offset Properties** (new in 6.0.9-beta):

* **Current Position Scale**: Scale factor applied to both position commands and feedback
* **Current Position Offset**: Offset in millimeters applied to both position commands and feedback
* **Scale Feedback Position**: When enabled (default), applies symmetric scale/offset transformations

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-3436a3e5e1c03aaa268ea5696b923c517bf908dc%2Fdrive-continousdestination-2025.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_Speed <a href="#drive-speed" id="drive-speed"></a>

Drive\_Speed is controlling a drive by a speed. You can't control directly the position. The drive is always driving in the given speed. Positive speed values means forward direction. Negative speed values means backward direction. Please note, that the smooth acceleration is not working with this drive. If you want to stop the drive the speed needs to be set to zero.\
This Drive is specially useful for users who are reusing Simit models which are connected to NX Mechatronics Concept Designer. In NX Mechatronics Concept Designer this type of Drive is called *SpeedControl*.

**Position Feedback Properties** (new in 6.0.9-beta):

* **Current Position Scale**: Scale factor for position feedback transformation
* **Current Position Offset**: Offset in millimeters applied to position feedback
* **Scale Feedback Position**: When enabled (default), applies scale and offset to position feedback. Disable to receive raw position values.

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-bf8645eb3c0d3808f6d6d7c5205232bf6e572bf1%2Fdrive-speed-2025.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_ErraticPosition <a href="#drive-erraticposition" id="drive-erraticposition"></a>

This drive is only for test purposes. It is moves constantly to random positions between MinPos and MaxPos.

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-8cdb828ff160eac10dedab33d2a729e61ad73f75%2Fdrive-erraticposition-2025.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Drive\_Sequence <a href="#drive-sequence" id="drive-sequence"></a>

We recommend to not use DriveSequence any more and to use the new LogicStep visual programming which is simpler and gives you more flexibility. Please check [LogicSteps](https://doc.realvirtual.io/components-and-scripts/defining-logic/logicsteps).

#### Starting a sequence step <a href="#starting-a-sequence-step" id="starting-a-sequence-step"></a>

The Drive\_Sequence behavior allows to define simple sequences of motions. Each step in the sequence can set the Drive speed and the Drive Destination.\
The step is starting automatically after the step before. If a PLCSignal is defined in *Wait For Signal* the Step is not started before the Signal is set to true.

#### Ending a sequence step

In *Wait After Step* a time in seconds can be defined which should be waited after the drive is at its destination and before the next step is started. The *Finished Signal* is optionally and can be used to start external processes or Drive\_Sequences. This signal is set to true as soon as the step is finished

<div align="left"><figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-3cddeeb0e06775d67a26f0defbd3a497f6ff3772%2Fdrivebehavior_sequence.png?alt=media" alt=""><figcaption></figcaption></figure></div>

© 2025 realvirtual GmbH [https://realvirtual.io](https://realvirtual.io/) - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.realvirtual.io/components-and-scripts/motion/drive-behavior.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
