vsTASKER 7 User Manual
×
Menu
Index

Routine Properties

 
Routines are named functions that can be given quickly and easily to entities during design or runtime. They are used in Plans.
A routine is normally geolocalized (associated with a position on the map), like MoveTo
Then, selecting an entity and giving the routine MoveTo with a position on the map will immediately triggers the MoveTo code and make the entity moves towards the position.
 
Routines are mostly user-defined although vsTASKER comes with built-in routines (refer to the Developer Guide for the list). There is no limitation in the number or complexity of a routine as long as the designer follows basic runtime coding rules, meaning that the routine does not capture too much processing time at each call to not slow down the simulation frame rate.
 
A routine can be replaced with a logic or a component model but offers a more convenient way to associate sequence of actions and terrain coordinates.
 
Refer to the Developer Guide and the Tutorial Manual to learn the built-in routines and how to create your own.
Routines are piece of C++ code and are saved into the database. If you write some general purpose routines, try to export them into Data/Shared/Routines directory for later use or add them into you favorite database template to always have them listed.
 
Routine Properties
1

Import Export

1. Import Export
Routines can be Imported or Exported one by one.
To import, just select one from the Data/Shared directory (or anywhere else).
To export, select one from the list, use the Export button, then give the routine a name.
 
2

Routine List

2. Routine List
All database defined Routines are listed here. They also belong to the Template.
 
3

Routine Code

3. Routine Code
 
Code
Enter here the C++ code that will be called repetitively at the specified frequency, as soon as the Routine will be triggered.
Returning AGAIN insure that the piece of code will be called again at the next cycle (if cycle at selected)
Returning DONE will stop the Routine to run. 
 
Have in mind that loops or complex computations at every cycle might impact the overall CPU performance. If you must parse a long list of data, think about cutting it into chunks (10 or 100) at each cycle to distribute the load on several cycle and not on time (to avoid CPU peak like regular beat with visible impact on visual for example).
 
Parameters
Define here variables used by the Routine.
If you want the user to change the value using the automatic interface generator, use //&& after the definition:
ie:
        int   my_data;
        float my_speed;  //&& DEF[20]  UNIT[m/s]  HINT[Speed]
 
Here, my_speed will be declared as a public variable with an entry in the Routine Dyn-UI
my_data will remain private.
 
Help
Add here all information needed by the end user to know how to use the Routine and what are Parameters used for.
 
4

Name

4. Name
To create a new Routine, set the name in the field and press button
 
5

Update

5. Update
To rename a Routine, select it in the list, change the name then use this button.
You can also use it to force the update of the routine with the Code/Parameters/Help text values.
 
6

Reorganize

6.
Select one routine from the list and use the up or down arrow button to move the routine in the list.
 
7

Delete

7.
Select the Routine to delete and press this button.
 
8

Sort

8.
Sort alphabetically all routines.
 
9

Cycle at

9.
Select here the frequency at which the Routine shall be processed.
If the checkbox is not set, base RTC frequency is used by default.
When the checkbox is ticked, the frequency of the dropdown list will be used.
 
If Fixed Hz is selected, the frequency will be the wall clock frequency and will remain steady even if the simulation speed is changed.