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

snapcraft with different ROS_MASTER_URI

asked 2017-12-08 01:21:55 -0500

Chuong Nguyen gravatar image

updated 2017-12-08 09:48:39 -0500

Hello, I am trying to set a different ROS_MASTER_URI for my snap.

My package is very simple. Only have one launch file to lauch usb-cam package. My problem is that, I can not change the MASTER_URI when running the snap. Here is my snapcraft.yaml file

parts:
  workspace:    
    plugin: catkin
    rosdistro: lunar
    catkin-packages: [main_launch]

apps:
  usbcam:
    command: export ROS_MASTER_URI=http://192.168.0.28:11311/ roslaunch main_launch usb_cam_launch.launch 
    plugs: [network, network-bind]

But I got this:

auto-starting new master
process[master]: started with pid [4297]
ROS_MASTER_URI=http://localhost:11311

EDITS: My bashrc file already set MASTER_URI, but it does not affect snap:

export ROS_HOSTNAME=192.168.0.6
export ROS_MASTER_URI=http://192.168.0.28:11311/
source /opt/ros/lunar/setup.bash
source ~/Workspace/devel/setup.bash

Furthermore, how can I pass arguments to my snap command. Thanks in advance.

edit retag flag offensive close merge delete

Comments

I don't know anything about snap, but if the command section is essentially run in a bash session, then I believe the command line should be

ROS_MASTER_URI=http://.. roslaunch ..

you can set env vars for a specific invocation with bash, but then you don't use export.

gvdhoorn gravatar image gvdhoorn  ( 2017-12-08 03:06:15 -0500 )edit

Hi, thanks for your reply. Unfortunately, without export, snap throws an error:

FileNotFoundError: [Errno 2] No such file or directory: ~/workspace/prime/ROS_MASTER_URI=http://192.168.0.28:11311/'

Chuong Nguyen gravatar image Chuong Nguyen  ( 2017-12-08 09:50:07 -0500 )edit

Again: not a snap expert, but you could probably get around this by writing a small wrapper (bash) script that sets the env var and then starts your roslaunch .. command.

gvdhoorn gravatar image gvdhoorn  ( 2017-12-09 02:59:03 -0500 )edit

Other than that I think this is not a ROS questions, but a snapcraft one. I advise you to ask this on a more appropriate forum, such as Ubuntu's snapcraft forum.

gvdhoorn gravatar image gvdhoorn  ( 2017-12-09 02:59:52 -0500 )edit

If you do post there, could I ask you to please comment here with a link to your snapcraft forum post? That way we keep things connected.

gvdhoorn gravatar image gvdhoorn  ( 2017-12-09 03:03:47 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-12-10 02:02:00 -0500

Chuong Nguyen gravatar image

updated 2017-12-11 01:03:29 -0500

gvdhoorn gravatar image

Thanks gvdhoorn for your suggestion. I repost the question in snapcraft forum at https://forum.snapcraft.io/t/how-to-s...

The solution is to add

catkin-ros-master-uri: http://192.168.0.28:11311
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-12-08 01:21:55 -0500

Seen: 401 times

Last updated: Dec 11 '17