This is the top-level namespace of the rocon_interactions ROS package. It provides python utilities for working with the console.
This module defines exceptions raised by the rocon_interactions package. These exception names are all included in the main rocon_interactions namespace. To catch one, import it this way:
from rocon_interactions import InvalidInteraction
Bases: exceptions.Exception
Failed to start rapp.
Bases: exceptions.Exception
Failed to stop rapp.
Bases: exceptions.Exception
Whenever an interaction has been specified incorrectly.
This module defines a class and methods that represent the core of what an interaction is.
Bases: object
This class defines an interaction. It does so by wrapping the base rocon_interaction_msgs.Interaction msg structure with a few convenient variables and methods.
Validate the incoming fields supplied by the interaction msg and populate remaining fields with proper defaults (e.g. calculate the unique hash for this interaction). The hash is calculated based on the incoming display_name-role-namespace triple.
Parameters: | msg (rocon_interaction_msgs.Interaction) – underlying data structure with fields minimally filled via load_msgs_from_yaml_resource(). |
---|---|
Raises: | InvalidInteraction if the interaction variables were improperly defined (e.g. max = -1) |
A human friendly name that also uniquely helps uniquely identify this interaction (you can have more than one configured name instance) [int].
A crc32 unique identifier key for this interaction, see also generate_hash() [int32].
Classify whether this interaction is to be paired with a rapp or not.
Returns: | whether it is a pairing interaction or not |
---|---|
Return type: | bool |
Maximum number of instantiations that is permitted (e.g. teleop should only allow 1) [int].
Underlying data structure (rocon_interaction_msgs.Interaction)
Executable name for this interaction, can be a roslaunch, rosrunnable, global executable, web url or web app [int].
Compute a unique hash for this interaction corresponding to the display_name-role-namespace triple. We use zlib’s crc32 here instead of unique_id because of it’s brevity which is important when trying to id an interaction by its hash from an nfc tag.
Might be worth checking http://docs.python.org/2.7/library/zlib.html#zlib.crc32 if this doesn’t produce the same hash on all platforms.
Parameters: | |
---|---|
Returns: | the hash |
Return type: | int32 |
Load interactions from a yaml resource.
Parameters: | file_path (str) – file path of a yaml formatted interactions file (ext=.interactions). |
---|---|
Returns: | a list of ros msg interaction specifications |
Return type: | rocon_interaction_msgs.Interaction [] |
Raises: | YamlResourceNotFoundException if yaml is not found. |
Raises: | MalformedInteractionsYaml if yaml is malformed. |
Load interactions from a yaml resource.
Parameters: | resource_name (str) – pkg/filename of a yaml formatted interactions file (ext=.interactions). |
---|---|
Returns: | a list of ros msg interaction specifications |
Return type: | rocon_interaction_msgs.Interaction [] |
Raises: | YamlResourceNotFoundException if yaml is not found. |
Raises: | MalformedInteractionsYaml if yaml is malformed. |
This module provides a class that acts as a database (dictionary style) of some set of interactions.
Bases: object
The runtime populated interactions table along with methods to manipulate it.
Constructs an empty interactions table.
Parameters: | filter_pairing_interactions (bool) – do not load any paired interactions |
---|
Filter the interactions in the table according to role and/or compatibility uri.
Parameters: | |
---|---|
Returns interactions: | |
subset of all interactions that survived the filter |
|
Return type: | Interaction [] |
Raises: | rocon_uri.RoconURIValueError if provided compatibility_uri is invalid. |
Flag for indicating whether pairing interactions should be filtered when loading.
Find the specified interaction.
Parameters: | interaction_hash (str) – in crc32 format |
---|---|
Returns: | interaction if found, None otherwise. |
Return type: | Interaction |
Creates a temporary copy of the interactions and sorts them into a dictionary view classified by role.
Returns: | A role based view of the interactions |
---|---|
Return type: | dict { role(str) : :class:`.interactions.Interaction`[] } |
List of Interaction objects that will form the elements of the table.
Load some interactions into the interaction table. This involves some initialisation and validation steps.
Parameters: | msgs (rocon_interaction_msgs.Interaction []) – a list of interaction specifications to populate the table with. |
---|---|
Returns: | list of all additions and any that were flagged as invalid |
Return type: | (Interaction [], rocon_interaction_msgs.Interaction []) : (new, invalid) |
List all roles for the currently stored interactions.
Returns: | a list of all roles |
---|---|
Return type: | str[] |
Removed the specified interactions interactions table. This list is typically the same list as the user might initially send - no hashes yet generated.
Parameters: | msgs (rocon_interaction_msgs.Interaction []) – a list of interactions |
---|---|
Returns: | a list of removed interactions |
Return type: | rocon_interaction_msgs.Interaction [] |
This module provides a class that lets you conveniently load interactions from outside the interactions manager node post startup (i.e. not using params). This class is the skeleton of the load_interactions script which can be used in a roslaunch file in the following way:
<!-- instead of params, use the external loader and configure groups with default namespaces -->
<node pkg="rocon_interactions" type="load_interactions" name="load_interactions" args="-n '/web' rocon_interactions web">
<remap from="load_interactions/set_interactions" to="interactions/set_interactions"/>
</node>
Bases: object
This class is responsible for loading the role manager with the roles and app specifications provided in the service definitions.
Don’t do any loading here, just set up infrastructure and overrides from the solution.
Raises: | rocon_python_comms.NotFoundException, rospy.exceptions.ROSException, rospy.exceptions.ROSInterruptException |
---|
Parse a set of configurations specified in a yaml file found from file path and send the command toload/unload these on the interactions manager. For convenience, it also allows the setting of a namespace for the whole group which will only get applied if an interaction has no setting in the yaml.
Parameters: | |
---|---|
Raises: |
Parse a set of configurations specified in a yaml file found from resource (package/file name pair) and send the command toload/unload these on the interactions manager. For convenience, it also allows the setting of a namespace for the whole group which will only get applied if an interaction has no setting in the yaml.
Parameters: | |
---|---|
Raises: |
This module defines the class used to execute a ros node responsible for managing the ros api that manipulates interactions. —-
Bases: object
Manages connectivity information provided by services and provides this for human interactive (aka remocon) connections.
Whether this interactions manager is currently managing a pairing interaction or not.
Returns: | whether there is an active pairing or not |
---|---|
Rtype bool: |
Loop around parsing the status of 1) connected remocons and 2) an internal rapp manager if the node was configured for pairing. Reacts appropriately if it identifies important status changes (e.g. a rapp went down while this node is currently managing its associated paired interaction).
This module provides a class that can be used by other nodes to introspect and start/stop rapps on a rapp manager running on the same ros master.
Bases: object
Initialises from a conductor message detailing information about a concert client. Once established, this instance can be used as a convenience to start and stop rapps on the concert client.
Initialise the class with the relevant data required to start and stop rapps on this concert client.
Parameters: | function (status_callback) – handles toggling of pairing mode upon appropriate status updates |
---|
Flag indicating that the rapp manager has been found and services/topics connected.
Flag indicating if there is a monitored rapp running on the rapp manager.
Start the rapp with the specified remappings.
Parameters: |
|
---|
Raises: | FailedToStartRappError |
---|
Service proxy to the rapp manager’s start_rapp service
Callback that handles status updates of the rapp manager appropriately at a higher level (the interactions manager level).
Subscriber to the rapp manager’s status publisher
Stop a rapp on this concert client (if one should be running). This doesn’t need a rapp specification since only one rapp can ever be running - it will just stop the currently running rapp.
Raises: | FailedToStopRappError |
---|
Service proxy to the rapp manager’s stop_rapp service
This module defines a class used monitor the status of connected remocons and trigger when certain status updates happen. —-
Bases: object
Attaches a subscriber to a remocon publisher and monitors the status of the remocon.
Name of the connected remocon.
Holds the latest status (rocon_interaction_msgs.RemoconStatus) update from the remocon.
Module for parsing web interaction strings provided to the interactions manager.
Bases: object
Generic web interaction object that stores the type (web url or app) and the actual url to be used. This is important because the resulting url that will get formed for this interaction will have many extra arguments (name, remappings, parameters) appended to the url here if it is a web app.
Prefix used to define web apps (e.g. web_app(https://github.com/...)
Prefix used to define web urls (e.g. web_url(http://wiki.ros.org/rocon_interactions)
Don’t instantiate this directly, use the parse() method instead.
Parameters: |
---|
list of weak references to the object (if defined)
The interaction url (e.g. http://wiki.ros.org/rocon_interactions).
Tries to parse the specified string to see if it is a valid web interaction (web app or web url). If it is, it passes back a web interaction object, or None if it is not valid.
Parameters: | str (interaction) – the string to parse. |
---|---|
Returns: | the web interaction object if parsed |
Return type: | WebInteraction or None |