robot_skills.robot_part

Attributes

SIM_MODE

Classes

RobotPart

Base class for robot parts

Module Contents

robot_skills.robot_part.SIM_MODE
class robot_skills.robot_part.RobotPart(robot_name, tf_buffer)[source]

Bases: object

Base class for robot parts

Constructor

Parameters:
  • robot_name – string with robot name

  • tf_buffer – tf buffer object

robot_name
tf_buffer: tf2_ros.Buffer
parts
functionalities = []
__ros_connections
__diagnostics_name = ''
_operational = True
close()[source]

Close the robot part

add_part(partname, part)[source]

Add a component part to the robot part. This is added to the parts dict and set as an attribute

Parameters:
  • partname – name of the bodypart

  • part – bodypart object

load_param(param_name, default=None)[source]

Loads a parameter from the parameter server, namespaced by robot name

Parameters:
  • param_name – parameter name

  • default – default value for when parameter unavailable

Returns:

loaded parameters

wait_for_connections(timeout, log_failing_connections=True)[source]

Waits for the connections until they are connected

Parameters:
  • timeout – timeout in seconds

  • log_failing_connections – (bool) whether to log errors if not connected. This is useful when checking multiple robot parts in a loop

Returns:

bool indicating whether all connections are connected

create_simple_action_client(name, action_type)[source]

Creates a simple actionlib client and waits for the action server

Parameters:
  • name – string with the name of the action in the correct namespace

  • action_type – action type of this action

Returns:

the action client

create_service_client(name, srv_type)[source]

Creates a service client and waits for the server :param name: string with the name of the service in the correct namespace :param srv_type: service type :return: the service client

create_subscriber(name, *args, **kwargs)[source]

Creates a Subscriber and add to the connections to check

Parameters:
  • name – string with the name topic to subscribe

  • args – other args passed to rospy.Subscriber

  • kwargs – other keyword args passed to rospy.Subscriber

Returns:

the Subscriber

_add_connection(name, connection)[source]

Adds a connection to the internal dict with connections that is used when initializing the robot object.

Parameters:
  • name – name of the connection

  • connection – connection to add. This might be a ServiceProxy, ActionClient or Subscriber

property operational

Check whether this bodypart’s hardware is operational If the associated hardware is not yet up, has an error etc, the bodypart is not operational. Note: in in simulation: operational is always true

Return type:

bool True is part is ready to do work, False otherwise

subscribe_hardware_status(name)[source]

Start to check if the bodypart is operational. To do so, subscribe to the hardware status/diagnostics

Parameters:

name – check on the level of the diagnostic_msgs/DiagnosticStatus with this name

unsubscribe_hardware_status()[source]
When process_hardware_status sees that self.__diagnostics_name evaluates to False,

it will not process the diagnostics and ignore them

process_hardware_status(diagnostic_dict)[source]

hardware_status callback to determine if the bodypart is operational

Parameters:

diagnostic_dict – dictionary[str, diagnostic_msgs.msg.DiagnosticStatus]

Returns:

no return

reset()[source]

Reset body part and all its components, this function should not be overwritten.

Returns:

Succes

Return type:

bool

selfreset()[source]

Reset of the body part itself. This function may be overwritten. Returns: bool