-
 

jacro repository

Repository Summary

Checkout URI https://github.com/JafarAbdi/jacro.git
VCS Type git
VCS Version main
Last Updated 2024-11-13
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
jacro 0.2.0

README

Jacro

Think “xacro” but with Jinja - we just swapped the “x” for “j”. Not the most creative naming! 🤷 Just a small wrapper around jinja2 - if you’re not using ROS 2, you probably want to use jinja2 directly!

Build Status

Usage

import jacro

jacro.process_text("Text {{ arg1 }}/{{ arg2 }}", mappings={"arg1": "value1", "arg2": "value2"})
jacro.process_file("filename.ext", mappings={"arg1": "value1", "arg2": "value2"})

You can use all functionality from jinja2 (even as a replacement to xacro itself!)

Custom functions

Currently, jacro have the following extra registered functions:

  • ros_pkg_path('pkg'): Will be replaces with the shared directory of ‘pkg’
urdf: {{ ros_pkg_path('my_robot_description') }} -> urdf: /path/to/my_robot_description/share/my_robot_description
urdf: {{ ros_pkg_path('std_msgs') }} -> urdf: /opt/ros/humble/share/std_msgs

Command-Line Interface

To save the output to a file, use the -o or --output option.

jacro input_filename -o output_filename arg1=value1 arg2=value2 ...

To print the output to the console

jacro input_filename arg1:=value_1 arg2:=[1, 2, 3] arg3:=["asd", "jafar"] ...

Linting

Using pre-commit

pre-commit run -a

Testing

Using pytest directly

python -m pytest --capture=no

Or using colcon

colcon build --packages-up-to jacro
colcon test --packages-select jacro
colcon test-result

CONTRIBUTING

No CONTRIBUTING.md found.