python ament cmake
Use ament_cmake to create python package
- Create ament package
- Add folder
my_cmake_py_pkg
- Add
__init__.py
inmy_cmake_py_pkg
to mark as python module - Add node python file
my_node.py
- Set
my_node.py
as executable - Add shabang
#!/usr/bin/env python3
inmy_node.py
- Edit to
CMakeLists.txt
- Edit
package.xml
Create package
CMakeLists.txt
package.xml
Add ament_cmake_python
in buildtool_depend
python nodes
- Create folder with the package name
- Create
__init__.py
in the folder - Every node should have
#!/usr/bin/env python3
as first line - Make the node executable
chmod +x my_node.py
usage
VScode tips
Install chmod
extension to set handle executable bit on file