mbeutelspacher / ros.el

A package to ease the interaction ROS nodes and the development of ROS software
GNU General Public License v3.0
10 stars 3 forks source link

[[https://melpa.org/#/ros][file:https://melpa.org/packages/ros-badge.svg]]

Since ros.el supports ROS1 and ROS2, it uses [[https://colcon.readthedocs.io/en/released/user/quick-start.html][colcon]] as its build system. Therefore Catkin workspaces are not supported. ** Setup :PROPERTIES: :CREATED: [2021-07-30 Fri 09:36] :ID: 7dbbb6f8-70bf-4ced-a1f6-4eaa18580e55 :END:

1) Install the package from Melpa 2) Setup your ROS Workspaces. The chaining of the workspaces is configured explicitly by specifying the whole chain in the extends list.

+BEGIN_SRC emacs-lisp

(setq ros-workspaces (list (ros-dump-workspace :tramp-prefix nil :workspace "~/main_ws" :extends '("/opt/ros/noetic/")) (ros-dump-workspace :tramp-prefix nil :workspace "~/overlay_ws" :extends '("/opt/ros/noetic/" "~/main_ws/install"))))

+END_SRC

The =tramp-prefix= can be used to setup remote workspaces over ssh or in docker containers

+BEGIN_SRC emacs-lisp

(setq ros-workspaces (list (ros-dump-workspace :tramp-prefix (format "/docker:root@%s:" docker-container-id) :workspace "/ws" :extends '("/opt/ros/noetic/"))))

+END_SRC

3) Map the ROS Hydra (=hydra-ros-main/body=) to a prefix key. 4) Select your current workspace by using =ros-set-workspace= or (=PREFIX+w=). Usage :PROPERTIES: :CREATED: [2021-07-30 Fri 09:59] :ID: f632f50e-5977-44e1-970f-2f9900ec0b74 :END: The hydra in =hydra-ros-main/body= incorporates most of the commands which are implemented. It heavily makes use of the =transient= menus to provide more options for the commands ** Compiling :PROPERTIES: :CREATED: [2021-07-30 Fri 10:25] :ID: f2dedc99-909d-4d87-86de-c93163656151 :END: You can compile in your current workspace either individual packages or the whole workspace. Similarly you can decide to also run the tests. Every compile action you do is added to the =ros-colcon-action-history= and you can redo an action by using =ros-compile-action=, which prompts for a past action. Every action is accompanied with the workspace and additional flags. So you can compile package =A= in workspace =W1= then switch to workspace =W2= and compile package =B= in there and if you then choose to redo the first action you will do it properly in workspace =W1=. Tests :PROPERTIES: :CREATED: [2021-07-30 Fri 10:31] :ID: 52566ad1-4ead-4693-bf26-5b6a549b8a83 :END: Run tests for a package or the whole workspace (without triggering a build before). Packages :PROPERTIES: :CREATED: [2021-07-30 Fri 10:33] :ID: e67e29e0-77cc-40ad-bd0a-ba6e14102733 :END: For a specific package, go to the source, find file in package or search in the package Messages / Services / Actions (only ROS2) :PROPERTIES: :CREATED: [2021-07-30 Fri 10:34] :ID: be8eb828-4e43-4adb-8892-2af3690fa872 :END:

Show the definition of certain messages, services or actions, insert the name at point or include the definition in your current source file (works in cpp and python files) *** Cache :PROPERTIES: :CREATED: [2021-07-30 Fri 10:35] :ID: f4acdfaf-1ed3-4af0-af52-8567a315b054 :END: Since setting up the list of packages, messages, services or actions takes quite a bit of time, these lists are cached after the first time they are build after emacs starts ( separately for every workspace ). If these changes or you add new packages or messages you might want to clean this cache