Skip to main content

A collection of tools to remove ROS2 worflow hurdles.

Project description

Github All Releases

Description

This is a collection of tools to remove ROS2's worflow hurdles for python3/colcon based projects

Requirements

  • ROS2(only tested on foxy)
  • Bash
  • RVIZ2
  • colcon

Optional Requirements:

  • snapcraft + FreeCAD(if using the URDF converter)

Installation

pip install ros2_easy

if using the model -> urdf -> sdf converter for FreeCAD as well:

sudo snap install freecad
freecad.pip install pycollada
freecad.pip install trimesh

To demo

run simple_run_caller.py

To use:

1: ensure your ROS2 file structure is in the following format:

/project_dir
	/src
		/example_pkg
			/rviz
				example_rviz.rviz
			/launch
			/example_pkg
				__init__.py
				sample_code.py
			/urdf

			/models
				(OPTIONAL)
				FreeCAD_model.FCstd
				
			package.xml
			setup.cfg
			setup.py
		/other_pkg1
		/other_pkg2
	simple_run_caller.py
	export_model_to_urdf.py  #if using the FreeCAD urdf_converter

2: define your packages in terms of ros2_easy Package objects. E.G:

#for example package
example_pkg = Package("example_pkg", "sample_code", build=True, entry_point="main")

#for rviz(to be moved to common_packages later)
rviz2_config_name = "rviz_config_test.rviz"
rviz2_pkg = Package("rviz2", "rviz2", config=Config(config_file_name=rviz2_config_name), optional_launch_file_node_args= {"arguments": "['-d', share_directory + '/rviz/%s']" % rviz2_config_name})

3: define your ros2 project enviorment as a ros2_easy launch_configuration. E.G:

rviz_env_conf = launch_configuration(
    config_store_pkg=example_pkg,
    launch_file="example_launch.py",
    urdf_file_name="FreeCAD_model",
    packages_to_run=[example_pkg, rviz2_pkg, rqt_pkg, robot_state_publisher_pkg],
    )
	"""launch configuration for testing sample_code.py""""

4: run the tools you'd like to use

#add all folders in example_pkg to .install folder
simple_run.replace_setup_py(rviz_env_conf)
#generate a launch file to run based on launch_configuration
simple_run.generate_launch_py(rviz_env_conf)
#(OPTIONAL AND WIP) convert a FreeCAD model defined in export_model_to_urdf.py
# and convert from model -> urdf
simple_run.create_urdf_of_model(rviz_env_conf)
# run launch configuration
simple_run.construct_bash_script(rviz_env_conf)

Tools:

setup.py replacer:

when ran, the setup.py replacer will replace a package's old setup.py with one which adds every sub folder in your config storing package to PATHS, this way, you don't need to manually edit setup.py. Call this function, set its variables, and no longer worry about configs not being added to PATHS (should make this backup old one to an archive folder to make this not accidently destructive..) (also need to make it so folders inside folders get added...)

launch file generator:

stream-line the process of creating a launch file by avoiding editing launch files them selves and instead using the launch_configuration class. simply define your packages/external programs to run with the package class/CMD_program classes respectively, add them to your launch_configuration, and the generator will make a launch file to accomidate them.

ros2 enviorment runner:

when ran will:

  • delete old build relics

  • generate a .sh bash script which sources ROS2

  • colcon builds packages you've defined in your launch_configuration(clarify on this later),

  • sources your built packages

  • runs your generated launch file from the launch file generator

gazebo sdf loader(HELP NEEDED):

converts your urdf to sdf and loads it in an empty gazebo world(add more details/features here)

help needed here to better gazebo integration with this library!

(FREECAD MODELS ONLY & WIP): model -> urdf converter

by moving the export_model_to_urdf.py script next to your simple_run caller script, and calling

 simple_run.create_urdf_of_model(<your_luanch_configuration>) 

and hard coding parts(as seen in !!!insert model_pkg example here!!! of the model via Model class, you can convert a FreeCAD model to a urdf.

A graphical version of this tool is TODO

Project details


Release history Release notifications | RSS feed

This version

0.4

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ros2_easy-0.4.tar.gz (22.6 kB view hashes)

Uploaded Source

Built Distribution

ros2_easy-0.4-py3-none-any.whl (23.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page