Collection of packages that allows writing ROS2 nodes in Lua.
- support for publishers and subscriptions
- support for clients and services
- support for action clients and coroutine-based services
- support for lifecycle nodes
- parameter server
- message generation
Assuming ROS2 humble installed to the standard location in Linux, run the following commands:
source /opt/ros/humble/setup.pash
mkdir -p ~/ws_lua/src && cd ws_lua/src
git clone -b humble https://github.com/mikhel1984/ros2_lua.git
cd ..
colcon build --symlink-install
Lua messages for default ROS interfaces can be generated using rcllua_std_msgs node. The list of messages is defined inside the CMakeLists file and could be edited acording the repository requirements.
ros2_lua uses CMake functionality for all the operations with Lua nodes.
cd src
ros2 pkg create --build-type ament_cmake project_name
Lua scripts could be placed in any location inside the project directory, but it is recommended to make project_name subdirectory and keep files inside it. Later this subdirectory can be added to LUA_PATH for sharing code with other scripts and writing unit tests.
See rcllua_examples for details.
Add dependencies.
find_package(rcllua REQUIRED)
find_package(rcllua_cmake REQUIRED
Add files for execution via ros2 run and launch files in form.
rcllua_cmake_executable(project_name/script.lua exe_name)
The library can be addedd to LUA_PATH with command
rcllua_cmake_install_lib(project_name)
If there is C/C++ Lua component inside the package, build it as a usual shared library and add to CPATH_LUA with command
rcllua_cmake_install_clib(project_name lib_name)
See rcllua_unit for details.
Build package as usual, simlink mode is recommended.
. install/setup.bash
colcon build --symlink-install --packages-select project_name
- Lua 5.3+
- ROS2 Huble