You have created a Behavior. It is not yet operational.
Here is how you can fix the bugs.
To test a Behavior:
Step | Action |
---|---|
Make sure the Autonomous Life is off. If not, click the Turn autonomous life off button. |
|
Click the Play button. |
If your Behavior runs well, see: Debugging an Activity.
Otherwise, try the following tips and tricks:
To control a Behavior:
Step | Action |
---|---|
Click the Play button to load it on the robot. | |
Double-click on an input or output to stimulate it. |
Each time a link between 2 boxes is simulated, the color of the link changes. It is a good way to check the execution.
When a box has a value as output, the last value displays in the Tooltip.
It becomes red during the execution:
An exception raised. It can be because a module cannot be loaded (virtual robot), does not exist, etc.
It becomes red before the execution (just after clicking the Play button):
The box code contains an error. It can be a typing problem in a Python script.
The small eye next to each layer allows you to “mute” a layer: it will be ignored when the Behavior is played.
This can be useful when you want to debug your Behavior.
self.logger is standard Python logger created with the Python module Logging.
The log information can be categorized by level of severity (each level has its associated font color in the debug window):
In your Python script, we recommend you to add warning, error and critical logs to inform when you Behavior dangerous or erroneous state.
You can also use info and debug to trace execution flow of your Behavior.
Step | Action |
---|---|
Open the script of a box. | |
Add the self.logger line in a function as below: def onLoad(self):
self.logger.debug("Loaded box %s", self.getName())
|
|
In the Debug window, select the minimum level of information you want, Debug in our case. | |
Execute the box. | |
All debug message display in the debug window to let you understand what is going on. The potential debug, info, warning, error and critical messages of other functions also display as the minimum level asked is debug. If you choose error, you see only error and critical messages. |