-
Notifications
You must be signed in to change notification settings - Fork 33
main block
The JSON file can only define block parameters that are simple types. For more complex applications we may want to define objects to describe poses (eg. SE3
instance), robots (eg. ETS.Panda
instance), cameras (eg. CentralCamera
instance) etc. To do this we need a Python script to instantiate the objects and the .bd file to describe the blocks and their connectivity. There are two ways to go.
Write a Python script that will:
- setup the runtime environment
- load the model using
bdload
- run the model using
run
bdedit
has a run button which will:
- save the current model as a
.bd
file. If it is a new model that has not yet been saved, you are prompted for the file name. - execute the command
bdrun OPTIONS FILENAME.bd
wherebdrun
is a Python script shipped withbdsim
that will load the model specified by its argument and run it. Standardbdsim
options can be given to control graphics, animation, runtime etc.
If the model requires instantiation of objects before it can be run, it should include a MAIN block which contains the name of a script. In this case, the run button will:
-
save the current model as a
.bd
file. If it is a new model that has not yet been saved, you are prompted for the file name. -
execute the command
main OPTIONS FILENAME.bd
wheremain
is a Python script provided by the user. By convention these files are namedmodel-main.py
wheremodel.bd
is the name of the block diagram model file. This script will:- setup the runtime environment
- load the model, specified by the script argument, using
bdload
. and run it. Standardbdsim
options can be given to control graphics, animation, runtime etc. - run the model using
run
Copyright (c) Peter Corke 2020-23
- Home
- FAQ
- Changes
- Adding blocks
- Block path
- Connecting blocks
- Subsystems
- Compiling
- Running
- Runtime options
- Discrete-time blocks
- Figures
- Real time control
- PID control
- Coding patterns