Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Source:

Report:


...

Introduction

The purpose of the behavior module is to serve as a common interface for the most used output modules, and in addition provide an easy way to make and execute new behavioral presets and simple states. The behavior module is intended to be interfaced in the same way as the action server states already implemented, to avoid heavy modifications to the controller module. In order to cover the role of a complete action server state for the Cyborg, the module must be able to exploit the emotional state of the Cyborg to choose which behavior to execute in the active state, and provide emotional feedback while doing so. It should also implement a way to change audible and visual modes in certain states, facilitating dynamic behavior while a state is active. A context diagram for the behavior module is seen in Figure 6.1 (AB). The figures have a notation behind then noting which thesis or report to find them in. AB = Areg Babayan, Masters thesis 2019.

...

A description of the functions in the module is given:

FunctionDescription
emotionalcallbackCallback for the subscriber to topic /cyborgcontroller/emotional_state. Updates the modules emotional state variable when a message is received.
callback_command_locationCallback for subscriber to topic /cyborg_behavior/command_location. Updates the modules commandlocation_ variable when a message is received.
server_behavior_callbackCallback for the /cyborg_behavior action server. When an action goal is received, the callback checks if the requested preset exists, first by appending the name of the behavioral state to the name, and then without if no preset for that particular emotional state is found. If no preset at all is found, the callback sets the server state as aborted and returns. If the name of the requested preset is found, the enter and execute_behavior functions are executed in sequence.
enterExecuted by server_behavior_callback. Retrieves parameters for the behavioral presets and updates the corresponding variables in the module. If the preset involves navigation, an action client for the navigation modules action server is instantiated.
execute_behaviorExecuted by server_behavior_callback. Activates the different output modules, for the navigation module it sends navigation goal, while for the audio and visual module, commands are published on their respective topics. The function checks the behavior_finished variable to see if the behavior is finished, the state of the navigation server when it is used, and for preemption request from the module using the behavior action server. If navigation or the behavior server is preempted, a preemption command is sent to audio modules utilized in the current preset. When the behavior is finished, send_emotion is used to provide emotional feedback to the Cyborg controller.
callback_dynamic_behaviorCallback for the topic /cyborg_behavior/dynamic_behavior, only active when the parameter for dynamic behavior is set. Parses message and activates the corresponding output modules.
callback_navigation_doneCallback for the navigation module. Sets the behavior finished variable when called.
change_behaviorCalled by callback_dynamic_behavior when a behavior command is intercepted. Retrieves behavioral parameters for the audio and visual module and executes.
callback_playbackCallback for topic /cyborg_audio/feedback_playback, handles feedback for audio playback and sets the behavior_finished variable accordingly.
callback_text_to_speechCallback for topic /cyborg_audio/feedback_text_to_speech, handles feedback for text to speech and sets the behaviorfinished_ variable accordingly.
send_emotionPublishes emotional feedback when executed.

How to add new bahviour

New behavioral presets are configured by appending the desired preset to the behavior.launch file in the behavior module. Presets are added to the Cyborg state machine in the same way as other action server states, shown in the following code:

...