A repository containing gym-based envs built on ROS to be combined with the Thing mobile manipulation platform at UTIAS.
This package is designed to be combined with the thing ROS package which is currently private and must be built and run in ROS Indigo and Ubuntu 14.04. We are making it public with the goal of making our experimental results using it easier to produce, since the reliance on our private Thing package is minimal. Assuming that your computer is running a later version of Ubuntu, the thing packages can be built and run in a docker image.
The environments are tested with ROS Noetic and Ubuntu 20.04. Since ROS Noetic is built with python3, you can directly call these gym envs from your learning code built on python3.
- ROS
- Currently only tested with Noetic on Ubuntu 20.04.
- ros-np-tools
- realsense-ros
-
thing_gym_ros
is technically a ROS package, but only to give the running code access to custom messages (and possibly services in the future). To ensure the thing environments have access to these custom components, this repository needs to be under asrc
folder in a catkin workspace (e.g.~/catkin_ws/src
). Before you can use the environments here, you must callcatkin_make
and thensource devel/setup.bash
. -
(optional) To reduce unnecessary warning messages, under your
catkin_ws/src
folder containingthing-gym-ros
, you also need to clone thewarning-fix
branch of our fork of geometry2. -
(optional) If you're using virtualenv/conda for python, you should be okay as long as the following considerations are met:
- Your
PYTHONPATH
should contain/opt/ros/ros_dist/lib/python3/dist-packages
, by default this is done when you callsource /opt/ros/ros_dist/setup.bash
, which should be in your.bashrc
after installing ROS. - Some python packages are not installed in
/opt/ros/...
, but rather/usr/lib/python3/dist-packages
. To access these libraries in your virtual/conda env, you need to install them manually (since adding/usr/lib/python3/dist-packages
to yourPYTHONPATH
doesn't work, nor should it). Most are installed automatically via thesetup.py
requirements, but unfortunately the version ofPyKDL
automatically installed viapip
is the wrong one, so you must install a custom wheel as follows:
pip install --extra-index-url https://rospypi.github.io/simple/_pre PyKDL
Thanks to @otamachan for setting this up.
- Your
-
In your learning python environment, install the package with
pip install -e .
The
-e
(editable) option allows you to modify files without having to reinstall.
-
Sim: (Probably in a docker image), bring up a thing simulation with a kinect:
roslaunch thing_gazebo thing_world.launch gui:=False kinect:=True
Real:
a) Turn on the Thing robot, plug into computer (probably Monolith), connect via ssh, and run
source trevor_ws/devel/setup.bash roslaunch thing_control ur10+FT+gripper_ros_control.launch
Currently using
trevor_ws
which is on branchfeature/mobile-base-demo-collection
since it has diverged from the master branch. See the thing repository for more info.b) Plug realsense into computer (probably Monolith), and run (in another terminal)
source REALSENSE_CATKIN_WS/devel/setup.bash roslaunch realsense2_camera rs_aligned_depth.launch
c) (optional for mobile base view-agnostic envs) First calibrate the realsense to the UR10. See instructions. Then, in your docker image with your thing installation, run
source THING_CATKIN_WS/devel/setup.bash roslaunch thing_utils realsense_publish_calibration.launch
d) (optional for viewing, though recommended for view-agnostic envs) Launch rviz, in your docker image, with
source THING_CATKIN_WS/devel/setup.bash roslaunch thing_utils thing_gym_ros_rviz.launch
-
With your system ROS installation (not in the docker-env), call
catkin_make
in the directory containingsrc/thing-gym-ros
. -
In the same folder, call
source devel/bash
. -
In your learning code, import whatever environments you want from this package, for example:
from thing_gym_ros.envs.reaching.visual import ThingRosReachAndGraspXYImageMB
-
Create an environment in your learning code and use it as you would any other gym env (ensuring you have completed step 3 in whatever environment you are calling this in):
env = ThingRosReachAndGraspXYImageMB() obs = env.reset() obs, rew, done, _ = env.step(env.action_space.sample())
For internal calculations and action specifications, xyzw quaternions are used. However, for ease of interpretability, poses in config files are represented with 6 components, with the first 3 being the translational component relative to the reference frame, and the last 3 as euler angles specified relative to the static (extrinsic, non-rotating) reference frame, and rotated about x, y, z (i.e. 'sxyz' from tf.transformations or transforms3d, see this reference for more info).