rsync_ros repository

Repository Summary

Checkout URI
VCS Type git
VCS Version master
Last Updated 2016-07-19


Name Version
rsync_ros 0.1.0



Build Status


This package brings Rsync operations (file transfer and syncronization) to ROS in the form of an actionlib interface. Making it convenient to transfer files from one machine to another using ROS. Progress from transfers is published as action feedback.

Potential Use Cases

An RsyncAction goal could be sent once a robot has reached a certain state. A file (e.g. a logfile or bagfile) could be then be transferred to a remote fileserver for storage.

Why Rsync?

Rsync is a fast and versatile utllity for file transfer, it is widely used for backups and mirroring, as well as an improved copy command for everyday use. It can copy locally, to/from another host over any remote shell, offering a large number of options that control every aspect of its behavior. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination.


To start the server

rosrun rsync_ros

CLI Actionlib Client Example

scripts/, a simple client based on the actionlib_tutorials simple actionlib client.

Local transfer

rosrun rsync_ros -avzp ~/a_file.txt ~/file_dest.txt

Remote transfer

You will first need to set up ssh keys for the remote machine, see this tutorial
rosrun rsync_ros -avzp ~/a_file.txt ssh_user@remote_host:~/file_dest.txt

Choosing Rysnc Arguments

The server passes all arguments listed in rsync_args to Rsync, although not all of the Rsync arguments have been tested. If you're unfamiliar with RSync, have a look at the manual to see the full list of arguments.

TL;DR The -avz argument works well for copy operations, and -avz --delete-source-files arguments for move operations. The -p argument (Partial Transfer) is particuarly useful for dealing with unreliable (wireless) connections.

Simple Python Actionlib example

#!/usr/bin/env python
import rospy
import roslib; roslib.load_manifest('rsync_ros')
import actionlib
import rsync_ros.msg
import sys


source_path =  '~/a_file.txt'
dest_path = 'SSH_USER@'

# Create the SimpleActionClient, passing RsyncAction to the constructor.
client = actionlib.SimpleActionClient('rsync_ros', rsync_ros.msg.RsyncAction)

# Wait until the action server has started up and started
# listening for goals.

# Create a goal to send to the action server.
goal = rsync_ros.msg.RsyncGoal(rsync_args=['-avzp'], source_path=source_path, destination_path=dest_path)

# Sends goal to the action server.

# Waits for the server to finish performing the action.

# Gets the result of the action
result = client.get_result()

# Prints out the result of executing the action
rospy.loginfo("Successful Transfer: {}".format(result.sync_success))  # An RsyncResult

Rsync Action Definition

string[] rsync_args #List of Rsync command line arguments e.g. ['-avzh', '--partial']

string source_path #e.g. "/home/user/file_to_sync.txt"
string destination_path #e.g. "ssh_username@"

bool sync_success #returns true if the file(s) synced correctly

float32 percent_complete
int64 transfer_rate #in bytes/second