ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Accessing install directory from a custom caktin tools verb

asked 2017-06-24 15:28:08 -0600

asymingt gravatar image

updated 2017-06-24 15:28:32 -0600

I would like to create my own verb called 'rsync' that deploys cross-compiled ROS packages on a destination target device using ssh over rsync. In order to do so, I need to access the install directory for my current build profile.

As per the instructions I have created a python script that looks something like this.

#!/usr/bin/env python

import os

def main(opts):
  for target in opts.targets:
    os.system("rsync -avz -e ssh  " + install_dir + " " + target)
  return 0

def prepare_arguments(parser):
  add = parser.add_argument
  # What packages to build
  add('targets', nargs='*',
    help='List of target names to rsync the files to.')
  return parser

description = dict(
  description="Deploy products to the robot over rsync",

My issue is that I cannot set the install_dir variable in the main function to the correct value for the current build profile. Does catkin tools provide a python module that I can get this information from?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-25 13:27:51 -0600

tfoote gravatar image

I think you will want to load a Context object from the workspace:

An example of doing so can be found in some of the existing verbs.

ctx = Context.load(opts.workspace, opts.profile, load_env=False)

Which shows you can also leverage the arguments from the context parser using add_context_args(parser)

edit flag offensive delete link more


Thanks, Tully! Catkin-tools is amazing :)

asymingt gravatar image asymingt  ( 2017-06-26 22:50:18 -0600 )edit

Question Tools



Asked: 2017-06-24 15:28:08 -0600

Seen: 231 times

Last updated: Jun 25 '17