snapcraft with different ROS_MASTER_URI
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.
I don't know anything about snap, but if the
command
section is essentially run in abash
session, then I believe the command line should beyou can set env vars for a specific invocation with
bash
, but then you don't useexport
.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/'
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.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.
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.