rickstaa / .ros_conda_wrapper

Wrapper for using ROS inside of a conda enviroment
MIT License
56 stars 2 forks source link

ROS Conda wrapper

Codacy Badge Maintained Contributions Python 3 Python 2 ROS versions ROS versions Supported shells

:warning: This repository contains the old (yet to be deprecated) way of using ROS+conda. As of Feb 2021 you are advised to use the RoboStack ROS Conda packages instead (see this blog post). This wrapper is left here as a fallback for when packages you need are not yet available on the RobotStack.

This wrapper solves some known problems/conflicts you might experience while trying to use ROS Kinetic/Melodic/Noetic inside a Conda environment (see this ROS topic).

How to setup

  1. Clone the repository to your user home directory and cd into the .ros_conda_wrapper folder.

    git clone https://github.com/rickstaa/.ros_conda_wrapper.git
    cd .ros_conda_wrapper

Automatic installation

  1. Run the install.sh script to install the ROS Conda wrapper.

Manual installation

For the manual installation instructions see this issue.

How to uninstall

To uninstall the ROS Conda wrapper run the uninstall.sh script before removing the .ros_conda_wrapper repository.

How to use

ROS Conda wrapper commands

All of the original conda commands work as expected. Additionally, a --ros-wrapper command has been added. This command takes the following options:

:information_source: The conda --ros-wrapper init command does not create the environment itself. It only performs some actions such that ROS will work inside a python 3 Conda environment.

Examples

Make conda environment ROS compatible

The following commands can be used to make a Conda environment ROS compatible:

conda create -n example_env python==3.6
conda --ros-wrapper activate
conda --ros-wrapper init example_env
conda activate example_env

Please note that this command installs the bare minimum of packages required to run ROS inside a Conda environment. If you need additional ROS packages, you can install them using the regular conda install <PACKAGE_NAME> command. Check the Conda package repository to see if they are available for CONDA.

Transform a ROS Conda Wrapper environment back to a typical Conda environment

The following commands can be used to transform a ROS Conda Wrapper environment back to a normal Conda environment:

conda --ros-wrapper deinit example_env
conda --ros-wrapper deactivate

ROS Conda wrapper environment variables

The ROS Conda wrapper adds the following environment variables:

How it works

The .conda_wrapper script creates an alias which wraps the original activate and deactivate Conda executable arguments. Following this wrapper modifies the PATH and PYTHONPATH such that the right python binaries are used. Additionally, the conda rosinit <NAME_OF_YOUR_ENVIRONMENT> command can be used to set up an environment in such a way that ROS works inside the environment. This is done by installing some additional python packages ROS needs (see this blog post by @wolfv).

Python compatibility notes

ROS Noetic

ROS Noetic was build for python3 and therefore does not support python2 packages.

ROS melodic

ROS Melodic was build for python2 and therefore in the past did not support python3. Currently all the main ROS Melodic packages have been ported to support python3. You might however still encounter third-party packages which do not support python3.

ROS Kinetic

ROS kinetic does not support python3. Further, there are no plans to port the ROS kinetic python2 packages too python3 (see ROS REP 3).

Issues

Please feel free to open an issue if you run into problems or have suggestions.

Acknowledgement

Contributing

Feel free to open an issue if you have ideas on how to make this GitHub action better or if you want to report a bug! All contributions are welcome. rocket Please consult the contribution guidelines for more information.

License

MIT