-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
.bdfile. 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.bdwherebdrunis a Python script shipped withbdsimthat will load the model specified by its argument and run it. Standardbdsimoptions 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
.bdfile. 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.bdwheremainis a Python script provided by the user. By convention these files are namedmodel-main.pywheremodel.bdis 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. Standardbdsimoptions can be given to control graphics, animation, runtime etc. - run the model using
run
Copyright (c) Peter Corke 2020-
- Home
- Control Systems Magazine article
- FAQ
- Changes
- Adding blocks
- Block path
- Connecting blocks
- Subsystems
- Compiling
- Running
- Runtime options
- Discrete-time blocks
- Figures
- Notebook animation
- PID control
- Coding patterns
- Block methods and attributes
- Event handling
- Discrete-time dynamics
- Blocks, wires and plug
- Discrete-time blocks
- Evaluation
- Runtimes and simulator state
- Creating a new block
- Future & related work
Under development on feat/realtime branch