Internal Modules

opsoro.animate

This module defines the interface for animating an expression.

class opsoro.animate.Animate(times, values)[source]

Bases: object

__init__(times, values)[source]

Class to facilitate the tweening of values in time. The animation starts when the object is created. Once ended, the call method will return the last item in values.

Parameters:
  • times (list) – A list of timestamps in seconds, in increasing order. Timestamp 0 is the moment the Animate object was created.
  • values (list) – A list of numerical values associated with timestamps. First element should be 0.
has_ended()[source]

Returns true if the animation has ended.

class opsoro.animate.Animate(times, values)[source]

Bases: object

__init__(times, values)[source]

Class to facilitate the tweening of values in time. The animation starts when the object is created. Once ended, the call method will return the last item in values.

Parameters:
  • times (list) – A list of timestamps in seconds, in increasing order. Timestamp 0 is the moment the Animate object was created.
  • values (list) – A list of numerical values associated with timestamps. First element should be 0.
has_ended()[source]

Returns true if the animation has ended.

class opsoro.animate.AnimatePeriodic(times, values)[source]

Bases: object

__init__(times, values)[source]

Class to facilitate the tweening of values in time. The animation starts when the object is created. This class is a variant of the Animate class that does not end, but instead repeats its pattern indefinitely.

Parameters:
  • times (list) – A list of timestamps in seconds, in increasing order. Timestamp 0 is the moment the Animate object was created.
  • values (list) – A list of numerical values associated with timestamps. First element should be 0.

opsoro.console_msg

opsoro.console_msg.print_apploaded(appname)[source]
opsoro.console_msg.print_appstarted(appname)[source]
opsoro.console_msg.print_appstopped(appname)[source]
opsoro.console_msg.print_error(msg)[source]
opsoro.console_msg.print_info(msg)[source]
opsoro.console_msg.print_spi(msg)[source]
opsoro.console_msg.print_warning(msg)[source]

opsoro.expression

This module defines the interface for communicating with the expression.

class opsoro.expression._Expression[source]

Bases: object

__init__()[source]
get_emotion_complex()[source]

Returns current emotion as a complex number

Returns:current emotion
Return type:complex
load_config(file_name='robot_expressions.conf')[source]

Load expressions from a expressions configurations file

Parameters:file_name (string) – name of the config file
Returns:True if file is successfully loaded
Return type:bool
save_config(file_name='robot_expressions.conf')[source]

Save the current expressions configurations

Parameters:file_name (string) – name of the config file
Returns:True if file is successfully saved
Return type:bool
set_config(config=None)[source]
set_emotion_e(e=0j, anim_time=-1)[source]

Set an emotion with complex number e, within a certain time.

Parameters:
  • e (complex) – complex number e
  • anim_time (float) – time to set the emotion
set_emotion_icon(icon, anim_time=-1)[source]

Set an emotion with icon if defined in expression list, within a certain time.

Parameters:
  • icon (string) – name of the icon to set
  • anim_time (float) – time to set the emotion
set_emotion_index(index, anim_time=-1)[source]

Set an emotion with index in defined expression list, within a certain time.

Parameters:
  • index (integer) – index of the emotion in the list of emotions
  • anim_time (float) – time to set the emotion
set_emotion_name(name, anim_time=-1)[source]

Set an emotion with name if defined in expression list, within a certain time.

Parameters:
  • name (string) – name of the emotion to set
  • anim_time (float) – time to set the emotion
set_emotion_r_phi(r, phi, degrees=False, anim_time=-1)[source]

Set an emotion with r and phi, within a certain time.

Parameters:
  • r (float) – radius of the circumplex
  • phi (float) – angle of the circumplex
  • degrees (bool) – is convertion to radians needed?
  • anim_time (float) – time to set the emotion
set_emotion_random(all_random=True, anim_time=-1)[source]

Set an emotion with random index in defined expression list, within a certain time. Or set all dofs to a random position between -1 and 1.

Parameters:
  • all_random (bool) – all dofs random or not
  • anim_time (float) – time to set the emotion
set_emotion_val_ar(valence, arousal, anim_time=-1)[source]

Set an emotion with valence and arousal, within a certain time.

Parameters:
  • valence (float) – valence
  • arousal (float) – arousal
  • anim_time (float) – time to set the emotion
update()[source]

Old function, not used in new system

Returns:nothing
Return type:None
opsoro.expression.constrain(n, minn, maxn)[source]

opsoro.robot

This module defines the interface for communicating with the robot.

class opsoro.robot._Robot[source]

Bases: object

__init__()[source]
alive_loop()[source]
apply_poly(r, phi, anim_time=-1)[source]
dof_update_loop()[source]
get_dof_values(current=True)[source]
load_config(file_name='robot_config.conf')[source]
save_config(file_name='robot_config.conf')[source]
set_config(config=None)[source]
set_dof(tags=[], value=0, anim_time=-1)[source]
set_dof_list(dof_values, anim_time=-1)[source]
set_dof_value(module_name, dof_name, dof_value, anim_time=-1)[source]
set_dof_values(dof_values, anim_time=-1)[source]
sleep()[source]
start(alive=True)[source]
start_alive_loop()[source]
start_update_loop()[source]
stop()[source]
stop_alive_loop()[source]
stop_update_loop()[source]
update()[source]
wake()[source]

opsoro.stoppable_thread

class opsoro.stoppable_thread.StoppableThread(*args, **kwargs)[source]

Bases: threading.Thread

Thread class with a stop() method. The thread itself has to check regularly for the stopped() condition.

__init__(*args, **kwargs)[source]
sleep(secs)[source]
stop()[source]
stopped()[source]