RobotRaconteurCompanion.Util.AttributesUtil

Utility classes to help with Robot Raconteur service attributes. Example usage:

import RobotRaconteur as RR
RRN = RR.RobotRaconteurNode.s
import RobotRaconteurCompanion as RRC
from RobotRaconteurCompanion.Util.InfoFileLoader import InfoFileLoader
from RobotRaconteurCompanion.Util.AttributesUtil import AttributesUtil

RRC.RegisterStdRobDefServiceTypes(RRN)
info_loader = InfoFileLoader(RRN)
camera_info, camera_ident_fd = info_loader.LoadInfoFileFromString(camera_info_text, "com.robotraconteur.imaging.camerainfo.CameraInfo", "camera")
attributes_util = AttributesUtil(RRN)
camera_attributes = attributes_util.GetDefaultServiceAttributesFromDeviceInfo(camera_info.device_info)

# Register a service and set attributes
service_ctx = RRN.RegisterService("camera","com.robotraconteur.imaging.Camera",camera)
service_ctx.SetServiceAttributes(camera_attributes)

AttributesUtil

class RobotRaconteurCompanion.Util.AttributesUtil.AttributesUtil(node=None, client_obj=None)

Utility class to get the default attributes from a DeviceInfo structure. These attributes are used to populate the default service attributes when registering a service with a device.

The following attributes are used:

  • device

  • parent_device

  • manufacturer

  • model

  • serial_number

  • user_description

Parameters:
  • node (RobotRaconteur.RobotRaconteurNode) – (optional) The Robot Raconteur node to use for parsing. Defaults to RobotRaconteurNode.s

  • client_obj (RobotRaconteur.ClientObject) – (optional) The client object to use for finding types. Defaults to None

GetDefaultServiceAttributesFromDeviceInfo(device_info)

Get the default service attributes from a DeviceInfo structure. These attributes are used to populate the default service attributes when registering a service.

Parameters:

device_info (com.robotraconteur.DeviceInfo) – The device info structure

Returns:

The default service attributes

Return type:

dict