This repository contains the source code to run the drozBot portraitist robot over ROS1. It contains 3 different packages:
ergodic_sketching
, the core C++ library.ergodic_sketching_msgs
, the definition of custom ROS messages, services, and actions.ergodic_sketching_ros
, the ROS interface of theergodic_sketching_library
.
The package also provides the following submodules:
ilqr_planner
, a library to optimize trajectory using iLQR.iiwa_description
, the package containing description of the KUKA iiwa LWR robot. The package is available on github with a BSD license.
- Clone this repository inside your catkin workspace.
- Initialize the submodules:
git submodule update --init --recursive
- Initialize the submodules:
- Build the workspace with
catkin build
.
You can setup the pipeline for the kuka robot with:
$ roslaunch ergodic_sketching_ros rob_sim.launch gui:=true
The gui
argument indicated wheter we want to use RVIZ or not.
This launch file starts two ROS nodes:
/ergodic_sketching_ros
a node responsible of the sketching part (transforming the image into a list of strokes). It advertises the following:- a
/ergodic_sketching_ros/sketch (ergodic_sketching_msgs/sketch)
service responsible of performing the sketching.
- a
/ilqr_planner_ros
a node responsible of the planning part (transforming the task space strokes into joint states coordinates). It advertises the following:- a
/ilqr_planner_ros/plan
action responsible of the planning. Since the list of strokes is quite big, the action break the planning into smaller part and return part of the joint state trajectory as feedback.
- a
A python script as been implemented to facilitate the use of the pipeline. See below.
The script rob_draw.py
automatize the call to /ergodic_sketching_ros/sketch
and /ilqr_planner_ros/plan
and take the path to an image as input. It publishes the joint states to the rob_sim/joint_states
topic:
$ python rob_draw.py -l <path_to_log_dir> -i <path_to_image>
<path_to_log_dir>
is a path to save the log of the sketching. It saves the joint positions, velocities, and optimization cost for investigation.
A test image is available in the images
folder.
When this script is used with the launch file described previously, it will automatically display all the results on RVIZ.
Standard image formats are working with this script. The recommended image resolution is 950x650 (HxW). Other resolution might distort the drawing or make the computation slower.
- Sketching parameters can be found here, here are the most common parameters:
num_strokes
: the number of strokes per sketch.num_agents
: the number of exploring agent for the ergodic exploration.timesteps
: the path size explored by one agent.drawing_orientation
: the end-effector orientation while drawing.
- Planner parameters can be found here:
q0
: initial joint configuration of the robot. The end-effector orientation should matchdrawing_orientation
.
Position of the drawing frame can be specified as argument with the roslaunch command:
$ roslaunch ergodic_sketching_ros rob_sim.launch gui:=true drawing_frame_xyz:=<position> drawing_frame_rpy:=<orientation>