Rosbag module

A ROS bag is a file format in ROS for storing ROS message data. The rapyuta.io platform allows you to record the ROS messages (ROS topics) for ROS enabled components deployed on the cloud.

Client Module

class Client(auth_token, project=None)

Client class provides access to device, package, volume and deployment classes.

__init__(auth_token, project=None)

Get new client object

Parameters
  • auth_token (string) – Authentication token

  • project (string) – project_guid of the user

create_rosbag_job(rosbag_job)

Create a ROSBag Job

Parameters

rosbag_job (ROSBagJob) – ROSBag object

Returns

Instance of ROSBagJob class

Following example demonstrates how to create a ROSBag Job.

>>> from rapyuta_io.clients.rosbag import ROSBagJob, ROSBagOptions
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> deployment = client.get_deployment('deployment_id')
>>> component_instance_id = deployment.get_component_instance_id('comp-name')
>>> rosbag_options = ROSBagOptions(all_topics=True)
>>> rosbag_job = ROSBagJob(deployment_id=deployment.deploymentId,
...              component_instance_id=component_instance_id,
...              rosbag_options=rosbag_options, name='name')
>>> rosbag_job = client.create_rosbag_job(rosbag_job)
delete_rosbag_blob(guid)

Delete the rosbag bag file

Parameters

guid (str) – blob guid

Following example demonstrates how to delete ROSBag Blob

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> client.delete_rosbag_blob('blob-id')
download_rosbag_blob(guid, filename=None, download_dir=None)

Download rosbag bag file

Parameters
  • guid (str) – blob guid

  • download_dir (str) – filename

  • filename (str) – filename

Following example demonstrates how to download ROSBag Blob

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> client.download_rosbag_blob('blob-id', 'filename.bag')
list_rosbag_blobs(guids=None, deployment_ids=None, component_instance_ids=None, job_ids=None, statuses=None, device_ids=None)

Get rosbag blobs based on the passed query params

Parameters
  • guids (list(str)) – list of blob guid

  • deployment_ids (list(str)) – list of deployment id

  • component_instance_ids (list(str)) – list of component instance id

  • job_ids (list(str)) – list of job guid

  • statuses (list(ROSBagBlobStatus)) – list of

  • device_ids (list(str)) – list of device id

Returns

list(ROSBagBlob)

Following example demonstrates how to stop ROSBag Blobs
  1. List specific ROSBagBlobs
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_blobs = client.list_rosbag_blobs(guids=['blob-id'])
    
  2. List all ROSBagBlobs of a deployment
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_blobs = client.list_rosbag_blobs(deployment_ids=['dep-id'])
    
  3. List ROSBagBlobs of a deployment’s component instance
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_blobs = client.list_rosbag_blobs(component_instance_ids=['dep-id'])
    
  4. List all ROSBagBlobs of a job
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_blobs = client.list_rosbag_blobs(job_ids=['job-id'])
    
  5. List ROSBagBlobs with statuses
    >>> from rapyuta_io import Client
    >>> from rapyuta_io.clients.rosbag import ROSBagBlobStatus
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_blobs = client.list_rosbag_blobs(statuses=[ROSBagBlobStatus.UPLOADED])
    
  6. List ROSBagBlobs of a device
    >>> from rapyuta_io import Client
    >>> from rapyuta_io.clients.rosbag import ROSBagBlobStatus
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_blobs = client.list_rosbag_blobs(device_ids=['device-id'])
    
list_rosbag_jobs(deployment_id, component_instance_ids=None, guids=None, statuses=None)

Get rosbag jobs based on the passed query params

Parameters
  • deployment_id (str) – deployment guid

  • component_instance_ids (list(str)) – list of component instance id

  • guids (list(str)) – list of job guid

  • statuses (list(ROSBagJobStatus)) – list of rosbag status

Returns

list(ROSBagJob)

Following example demonstrates how to get ROSBag Jobs
  1. List all ROSBagJobs of a deployment
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_jobs = client.list_rosbag_jobs(deployment_id)
    
  2. List ROSBagJobs of a deployment’s component instance
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_jobs = client.list_rosbag_jobs(deployment_id,
    ...                                       component_instance_ids=['comp-inst-id'])
    
  3. List specific ROSBagJobs of a deployment
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_jobs = client.list_rosbag_jobs(deployment_id, guids=['job-id'])
    
  4. List ROSBagJobs with statuses of a deployment
    >>> from rapyuta_io import Client
    >>> from rapyuta_io.clients.rosbag import ROSBagJobStatus
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_jobs = client.list_rosbag_jobs(deployment_id,
    ...                                       statuses=[ROSBagJobStatus.RUNNING])
    
list_rosbag_jobs_in_project(device_ids)

Lists rosbag jobs based on device ids

Parameters

device_ids (list(str)) – list of device id

Following example demonstrates how to list rosbag jobs in a project based on device ids:
  1. List all ROSBagJobs based on device ids
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> rosbag_jobs = client.list_rosbag_jobs_in_project(['device-id'])
    
stop_rosbag_jobs(deployment_id, component_instance_ids=None, guids=None)

Stop ROSBag Job based on the passed query params

Parameters
  • deployment_id (str) – deployment guid

  • component_instance_ids (list(str)) – list of component instance id

  • guids (list(str)) – list of job guid

Following example demonstrates how to stop ROSBag Jobs
  1. Stop all ROSBagJobs of a deployment
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> client.stop_rosbag_jobs(deployment_id)
    
  2. Stop ROSBagJobs of a deployment’s component instance
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> client.stop_rosbag_jobs(deployment_id, component_instance_ids=['comp-inst-id'])
    
  3. Stop specific ROSBagJobs of a deployment
    >>> from rapyuta_io import Client
    >>> client = Client(auth_token='auth_token', project='project_guid')
    >>> client.stop_rosbag_jobs(deployment_id, guids=['job-id'])
    

Rosbag Module

class ComponentType(value)

Enumeration variables for the ComponentType for ROSBag Job.

ComponentType.CLOUD

ComponentType.DEVICE

class MessageType

Message Type

Variables
  • message_type (str) – type of recorded message

  • md5 (str) – md5sum of messages

class ROSBagBlob

ROSBag file class

Variables
  • guid (str) – bag id

  • filename (str) – filename of bag file

  • job_id (str) – job id

  • job (ROSBagJob) – related job information

  • blob_ref_id (int) – blob id

  • status (ROSBagBlobStatus) – upload status of bag file

  • info (ROSBagInfo) – info about the bag file

  • creator (str) – user id

  • project (str) – project id

  • component_type (ComponentType) – component type

  • device_id (str) – device id

  • error_message (str) – reason for upload failure

class ROSBagBlobStatus(value)

Enumeration variables for the Supported ROSBag Blob Status. File Status may be ‘Starting’, ‘Uploading’, ‘Uploaded’, or ‘Error’

ROSBagBlobStatus.STARTING

ROSBagBlobStatus.UPLOADING

ROSBagBlobStatus.UPLOADED

ROSBagBlobStatus.ERROR

class ROSBagCompression(value)

Enumeration variables for the Supported ROSBag Compression. Compression may be ‘LZ4’, or ‘BZ2’

ROSBagCompression.LZ4

ROSBagCompression.BZ2

class ROSBagInfo

ROSBag file related information

Variables
  • bag_version (str) – version of bag file

  • duration (float) – total record time

  • start_time (float) – record start time

  • end_time (float) – record end time

  • size (int) – size of bag file

  • message_count (int) – number of messages

  • compression (str,) – compression used

  • uncompressed_size (int) – size of bag file without compression

  • compressed_size (int) – size of bag file with compression

  • message_types (list(MessageType)) – instance of MessageType

  • topics (list(TopicInfo)) – instance of TopicInfo

class ROSBagJob(name, rosbag_options, deployment_id=None, component_instance_id=None, upload_options=None)

ROSBag Job

Variables
  • guid (str) – guid of the job

  • deployment_id (str) – deployment id

  • component_instance_id (str) – component instance id

  • name (str) – name of the job

  • package_id (str) – package id

  • status (ROSBagJobStatus) – status of the job

  • component_id (str) – component id

  • component_type (ComponentType) – component type

  • device_id (str) – device id

  • creator (str) – user id

  • project (str) – id

  • rosbag_options (ROSBagOptions) – rosbag options

  • upload_options (UploadOptions) – Rosbag Upload Options

Parameters
  • name (str) – name of the job

  • rosbag_options (ROSBagOptions) – rosbag options

  • deployment_id (str) – deployment id

  • component_instance_id (str) – component instance id

  • upload_options (UploadOptions) – Rosbag Upload Options

class ROSBagJobStatus(value)

Enumeration variables for the Supported ROSBag Job Status. Job Status may be ‘Starting’, ‘Running’, ‘Error’, ‘Stopping’, or ‘Stopped’

ROSBagJobStatus.STARTING

ROSBagJobStatus.RUNNING

ROSBagJobStatus.ERROR

ROSBagJobStatus.STOPPING

ROSBagJobStatus.STOPPED

class ROSBagOptions(all_topics=None, topics=None, topic_include_regex=None, topic_exclude_regex=None, max_message_count=None, node=None, compression=None, max_splits=None, max_split_size=None, chunk_size=None)

ROSBag options

Variables
  • all_topics (bool) – Record all topics

  • topics (list(str)) – Record a bag file with the contents of the specified topics

  • topic_include_regex (list(str)) – Match topics using regular expressions

  • topic_exclude_regex (str) – Exclude topics matching the given regular expression

  • max_message_count (int) – Only record NUM messages on each topic

  • node (str) – Record all topics subscribed to by a specific node

  • compression (ROSBagCompression) – Compression can be LZ4 or BZ2

  • max_splits (int) – Split bag at most MAX_SPLITS times

  • max_split_size (int) – Record a bag of maximum size

  • chunk_size (int) – Record to chunks of size KB before writing to disk

Parameters
  • all_topics (bool) – Record all topics

  • topics (list(str)) – Record a bag file with the contents of the specified topics

  • topic_include_regex (list(str)) – Match topics using regular expressions

  • topic_exclude_regex (str) – Exclude topics matching the given regular expression

  • max_message_count (int) – Only record NUM messages on each topic

  • node (str) – Record all topics subscribed to by a specific node

  • compression (ROSBagCompression) – Compression can be LZ4 or BZ2

  • max_splits (int) – Split bag at most MAX_SPLITS times

  • max_split_size (int) – Record a bag of maximum size

  • chunk_size (int) – Record to chunks of size KB before writing to disk

class TopicInfo

Topic related information

Variables
  • name (str) – name of topics

  • message_type (str) – type of topic

  • message_count (int) – number of messages recorded

  • frequency (float) – frequency of topic

class UploadOptions(max_upload_rate=1048576, purge_after=False)

ROSBag Upload Options

Variables
  • max_upload_rate (int) – Upload Rate in Bytes for ROSBag Files

  • purge_after (bool) – Purge File after uploaded

Parameters
  • max_upload_rate (int) – Upload Rate in Bytes for ROSBag Files

  • purge_after (bool) – Purge File after uploaded