3.3. Shared Variables

3.3.1. Pseudo-enums

class pyrobotics.shared_variables.SharedVarTypes

Pseudo-enum of the types of shared variables.

The existing values are:

  • SharedVarTypes.BYTE_ARRAY
  • SharedVarTypes.INT
  • SharedVarTypes.INT_ARRAY
  • SharedVarTypes.LONG
  • SharedVarTypes.LONG_ARRAY
  • SharedVarTypes.DOUBLE
  • SharedVarTypes.DOUBLE_ARRAY
  • SharedVarTypes.STRING
  • SharedVarTypes.MATRIX
  • SharedVarTypes.RECOGNIZED_SPEECH
  • SharedVarTypes.VAR

The type VAR can be considered as an “unknown” type. It doesn’t do any special serialization or deserialization processing, instead it sends the string the user inputs as parameters directly.

class pyrobotics.shared_variables.SubscriptionTypes

Pseudo-enum of the types of subscriptions. (See SubscribeToSharedVar)

The existing values are:

  • SubscriptionTypes.CREATION
  • SubscriptionTypes.WRITE_MODULE
  • SubscriptionTypes.WRITE_OTHERS
  • SubscriptionTypes.WRITE_ANY
class pyrobotics.shared_variables.ReportTypes

Pseudo-enum of the types of reports. (See SubscribeToSharedVar)

The existing values are:

  • ReportTypes.CONTENT
  • ReportTypes.NOTIFY

3.3.2. SharedVar Objects

class pyrobotics.shared_variables.SharedVar(responseObj)

A wrapper for the shared variable notifications.

An object of this type is passed as parameter to every subscription handler function. (See SubscribeToSharedVar)

Objects of this class include the members:

sv.varName
The name of the shared variable of which a notification was received.
sv.svType
One of the class variables in the pseudo-enum SharedVarTypes.
sv.size
-1 if it is not an array type, an integer if sv.svType is of type SharedVariableTypes.BYTE_ARRAY, SharedVariableTypes.INT_ARRAY, SharedVariableTypes.LONG_ARRAY or SharedVariableTypes.DOUBLE_ARRAY.
sv.data
Contains the deserialized data of this shared variable, depending on its type.

3.3.3. Using Shared Variables

pyrobotics.BB.ReadSharedVar()

(See ReadSharedVar)

pyrobotics.BB.CreateSharedVar()

(See CreateSharedVar)

pyrobotics.BB.WriteToSharedVar()

(See WriteToSharedVar)

pyrobotics.BB.SubscribeToSharedVar()

(See SubscribeToSharedVar)

Table Of Contents

Previous topic

3.2. Messages, Commands and Responses

Next topic

3.4. Parallel (or asynchronous) Sender

This Page