Difference between revisions of "ROS2"

From ElphelWiki
Jump to: navigation, search
(Test Talker and Listener)
(1. Test Talker and Listener)
Line 22: Line 22:
 
====1. Test Talker and Listener====
 
====1. Test Talker and Listener====
 
* SSH session 1:
 
* SSH session 1:
  root@elphel393:~# AMENT_PREFIX_PATH=/usr ros2 run demo_nodes_cpp talker
+
  root@elphel393:~# export AMENT_PREFIX_PATH=/usr
 +
root@elphel393:~# ros2 run demo_nodes_cpp talker
 
* SSH session 2:
 
* SSH session 2:
  root@elphel393:~# AMENT_PREFIX_PATH=/usr ros2 run demo_nodes_cpp listener
+
  root@elphel393:~# export AMENT_PREFIX_PATH=/usr
 +
root@elphel393:~# ros2 run demo_nodes_cpp listener
  
 
Note: If AMENT_PREFIX_PATH is not set then:
 
Note: If AMENT_PREFIX_PATH is not set then:

Revision as of 13:59, 4 December 2018

GitHub

https://github.com/bmwcarit/meta-ros.git

ROS1

Build

  • Won't build

Work

  • Won't work

ROS2

Build

  • Add path to bblayers.conf
  • Add to "IMAGE_INSTALL_append" of core-image-elphel393.bb:
ros2-demo-nodes-cpp \
ros2topic \
ros2msg \
ros2run \

Work

1. Test Talker and Listener

  • SSH session 1:
root@elphel393:~# export AMENT_PREFIX_PATH=/usr
root@elphel393:~# ros2 run demo_nodes_cpp talker
  • SSH session 2:
root@elphel393:~# export AMENT_PREFIX_PATH=/usr
root@elphel393:~# ros2 run demo_nodes_cpp listener

Note: If AMENT_PREFIX_PATH is not set then:

Traceback (most recent call last):
  File "/usr/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.4.0', 'console_scripts', 'ros2')()
  File "/usr/lib/python3.5/site-packages/ros2cli/cli.py", line 64, in main
    rc = extension.main(parser=parser, args=args)
  File "/usr/lib/python3.5/site-packages/ros2run/command/run.py", line 59, in main
    executable_name=args.executable_name)
  File "/usr/lib/python3.5/site-packages/ros2run/api/__init__.py", line 30, in get_executable_path
    paths = get_executable_paths(package_name=package_name)
  File "/usr/lib/python3.5/site-packages/ros2pkg/api/__init__.py", line 41, in get_executable_paths
    prefix_path = get_prefix_path(package_name)
  File "/usr/lib/python3.5/site-packages/ros2pkg/api/__init__.py", line 34, in get_prefix_path
    prefix_path = get_package_prefix(package_name)
  File "/usr/lib/python3.5/site-packages/ament_index_python/packages.py", line 49, in get_package_prefix
    content, package_prefix = get_resource('packages', package_name)
  File "/usr/lib/python3.5/site-packages/ament_index_python/resources.py", line 37, in get_resource
    for path in get_search_paths():
  File "/usr/lib/python3.5/site-packages/ament_index_python/search_paths.py", line 30, in get_search_paths
    "Environment variable '{}' is not set or empty".format(AMENT_PREFIX_PATH_ENV_VAR))
OSError: Environment variable 'AMENT_PREFIX_PATH' is not set or empty