I am having some problems with Ubuntu Core and ROS. I am using Snapcraft. I was able to do the "create your first snap" tutorial (https://snapcraft.io/docs/build-snaps/your-first-snap) and everything was fine.
Then I followed the ROS tutorial (https://github.com/snapcore/snapcraft/blob/master/docs/ros-snap.md). Instead of doing a talker and a listener I just have one "hello world" node that outputs a message to the screen. I am able to build and install just fine, but on running I get the following output:
$USER@localhost:~$ ros-example.launch-project
... logging to /home/$USER/snap/ros-example/x1/ros/log/a413e04a-efb3-11e6-bf45-3d232f894a41/roslaunch-localhost.localdomain-7392.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Traceback (most recent call last):
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 307, in main
p.start()
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start
self._start_infrastructure()
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure
self._load_config()
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config
roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/config.py", line 471, in load_config_default
config.assign_machines()
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/config.py", line 222, in assign_machines
if [m for m in machine_unify_dict.values() if not is_machine_local(m)]:
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/core.py", line 97, in is_machine_local
local_addresses = ['localhost'] + rosgraph.network.get_local_addresses()
File "/snap/ros-example/x1/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/network.py", line 218, in get_local_addresses
for iface in netifaces.interfaces():
OSError: [Errno 13] Permission denied
I have added the install rules for the .cpp, .hpp, and .launch files in the cmake list, and running the roslaunch
command works to run the node. But running in the Core environment as a snap does not work. Any suggestions would be greatly appreciated.
Here's my cmakelist:
cmake_minimum_required(VERSION 2.8.3)
project(hello_world)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)
catkin_package()
include_directories(${catkin_INCLUDE_DIRS})
add_executable(write_prompt src/write_prompt.cpp)
target_link_libraries(write_prompt ${catkin_LIBRARIES})
install(TARGETS write_prompt
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN "*.hpp"
PATTERN ".svn" EXCLUDE
)
install(FILES
launch/run_code.launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
And my snapcraft.yaml:
name: ros-example
version: 1.0
summary: ROS Example
description: Runs a modified Hello World node
confinement: strict
apps:
launch-project:
command: roslaunch hello_world run_code.launch
parts:
ros-project:
plugin: catkin
source: .
catkin-packages:
- hello_world
rosdistro: kinetic