This tutorial focuses on the assistive feeding demo on an Ubuntu machine.
Assuming you already have ros-$DISTRO-desktop-full
installed (as per here) and the latest version of DART, here are the additional dependencies required from other repositories:
DISTRO=noetic
sudo apt install libopencv-dev libblas-dev liblapack-dev libmicrohttpd-dev libeigen3-dev ros-$DISTRO-control-toolbox ros-$DISTRO-ompl ros-$DISTRO-force-torque-sensor-controller ros-$DISTRO-srdfdom python3-wstool ros-$DISTRO-octomap-ros ros-$DISTRO-joint-trajectory-controller ros-$DISTRO-transmission-interface ros-$DISTRO-cv-bridge ros-$DISTRO-image-transport ros-$DISTRO-image-geometry ros-$DISTRO-diagnostic-updater ros-$DISTRO-controller-manager ros-$DISTRO-rviz python-catkin-tools
Replace noetic
with the appropriate ROS version: melodic
on 18.04 (Focal) and kinetic
on 16.04 (Xenial).
You might also need to install pybind: pip install pybind11[global]
If you cannot install python-catkin-tools
you may have to use this workaround to install directly from the source repo, for more details see this issue:
pip3 install -U "git+https://github.com/catkin/catkin_tools.git#egg=catkin_tools"
If you are on 20.04 (Focal), you should also symlink python
to python3
otherwise some scripts will be unable to find the python binary, causing "No such file or directory" errors when running roslaunch
:
sudo apt install python-is-python3
Docker containers are a useful way to isolate the environments used to develop and run code. They can be particularly useful to avoid clashes between different versions or distributions of libraries (for example, if you have an older version of ROS on your host computer but want to run ADA code with a newer version), and to enable code to easily work across computers. We have verified that the below instructions, and the included Dockerfile, work for running the demo in simulation.
- Configure the Docker PPA following the latest instructions (i.e., the instructions under
Install using the repository > Set up the repository
). - Install the Docker packages.
sudo apt-get update
sudo apt-get install docker-ce
- Start the Docker service:
sudo service docker start
- Create a new catkin workspace for use within your Docker container, and follow the below instructions in "PRL Git Packages" to load its packages.
- Navigate to
ada_feeding/docker
. - Build the docker container using
sudo docker build -t ada-sim .
- Enable the Docker container to render GUIs on the host computer with:
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
- Run the Docker container using
sudo docker run --rm --network host -v my_catkin_workspace:/workspace -v $XSOCK:$XSOCK:rw -v $XAUTH:$XAUTH:rw -e XAUTHORITY=${XAUTH} -e DISPLAY -it ada-sim
You are good to go! Note that any files created within the Docker container that are not within a mounted volume will be deleted once you exit the container (the relevant mounted volume in the above command is your catkin workspace). Further note that the best practice is to have a separate workspace for use within the Docker container, and to only build/source that workspace from within the container (to avoid clashes with ROS versions, library paths, etc.). Finally, note that steps 7-8 above have to be re-run whenever you want to enter your container.
We can install these all at once with wstool
.
If running everything in simulation, use ada-feeding-sim
(which installs fewer packages), otherwise, use ada-feeding
.
$ git clone https://github.com/personalrobotics/pr-rosinstalls.git ~/pr-rosinstalls
$ cd my_catkin_workspace/src
$ wstool init # exclude if already have .rosinstall
$ wstool merge ~/pr-rosinstalls/ada-feeding[-sim].rosinstall
$ wstool up
Note that some of the directories installed with the above rosinstall file may have special dependencies that were unmentioned in the README. If you run into errors building/running specific packages, refer to the READMEs of those packages for more details.
Install the Debian Package in this ZIP file
It should be in KINOVA SDK JACO/Ubuntu/64 bits/
.
You can install it using dpkg
:
sudo dpkg -i JACO1APi-5.2.0-amd64.deb
Note that the current demo has only been tested on the JACO 2.
Run the following commands from your ROS workspace:
catkin build
source devel/setup.bash
roscore
rviz
roslaunch ada_launch simulation.launch
(will put 2 simulated cantaloupe on the plate)roslaunch ada_feeding feeding.launch
(will quit after writing ROS parameters)cd my_catkin_workspace/devel/bin/
and./feeding
- In RViz, subscribe to the topic
feeding/update/InteractiveMarkers
to actually see the robot.
- Build your workspace with
catkin build
- Download the checkpoint by going into
src/pytorch_retinanet
and runningload_checkpoint.sh
(or train your own checkpoint) - Do the same in
src/bite_selection_package
: runload_checkpoint.sh
(or train your own checkpoint) - Make sure your source
devel/setup.bash
in every terminal you use.
- Start
roscore
,rviz
- Turn on ADA
- Once the lights on the joystick go solid, home ADA by holding the orange button until the robot stops moving.
ssh nano
(you may need to addnano
to your.ssh/config
, this is the Jetson on the robot). Once there, set your ROS Master usinguselovelace
,useweebo
, oruseweebowired
(or set your ROS_MASTER_URI manually), execute./run_camera.sh
to start streaming RGBD data.- You may have to adjust the camera exposure, depending on the lighting condition. Either run
run_adjust_camera_daylight.sh
orrun_adjust_camera_all.sh
after runningrun_camera.sh
. Check the image stream via rviz, by adding the image topic/camera/color/image_raw/color
. If some area is too bright and look burnt or saturated, reduce the exposure.
- You may have to adjust the camera exposure, depending on the lighting condition. Either run
roslaunch forque_sensor_hardware forque.launch
(Optionally addforque_ip:=<IPv4>
if your Net-FT is on a non-default IP)rosrun face_detection face_detection
roslaunch ada_launch default.launch feeding:=true detector:=spanet
- Optionally, run with
perception:=false
if you want to run perception manually in another terminal. - To run perception manually in another terminal:
rosrun food_detector run_perception_module.py --demo-type spanet
- Optionally, run with
roslaunch ada_feeding feeding.launch
(will quit after writing ROS parameters)- Optionally run
roslaunch ada_feeding data_collection.launch
afterfeeding.launch
if you're doing data collection.
- Optionally run
cd ~/Workspace/ada_ws/devel/bin/
and./feeding -af
-a
: specified that this is the real robot, and not a simulation-f
: enables the force/torque sensor on the real robot (REQUIRED when picking up food for safety)-c
: causes demo to proceed without the user pressing [ENTER] between steps-d
: Select demo to run.
- Advance the demo by pressing Return or terminate nicely by pressing
n
and then return
To run with acquisition detection (and not require manual success/failure input from the supervisor) run
roslaunch ada_launch default.launch feeding:=true acquisition_detection:=true
The model files will need to be downloaded by running ada_demos/feeding/bash_scripts/download_detector_checkpoint.sh
- In step 7,
feeding:=true
is responsible for loading the robot with camera and forque - Step 8 loads ros parameters for the feeding executable
- When the demo exits, it shuts down some controllers that were started. If it crashes, you'll need to restart the controller node (step 7)
- If launching the controllers (step 7) doesn't work properly, chances are a
JacoHardware
node didn't exit cleanly. I recommend checking for that by turning every ros node off and runningps -aux | grep jaco
to see if a process is still running and preventing your controllers from starting properly. - After running the demo one time, the Joystick switches from cartesian control to joint control until you restart Ada.
- DLIB_NO_GUI_SUPPORT: If you get this error when building
face_detection
: un-comment the#define
statement in/usr/include/dlib/config.h
.
- There are some repositories that have
ada
in their name but are out of date! Only the repositories in the rosinstall above should be required. openrave
is out of date and not required for this project.- Whenever you install something to fix dependencies, make sure to clean the affected repositories before you build them again!
- Whenever you run something, make sure to source the setup.bash in the workspace in every terminal you use! We recommend putting it in your
~/.bashrc
file. - If you have dartsim in the workspace, it might not link to
libnlopt
correctly and you might see an error message when compilinglibada
. When this happens, remove dartsim and installsudo apt-get libdart6-all-dev
. - If you run into internet connection problems, try running
sudo route delete default gw 192.168.1.1
. In general, when runningroute -n
, you should see the gateway192.168.2.1
above192.168.1.1
.
- The feeding demo has collision boxes for you and your computer, so the robot shouldn't try to hit you usually. But still:
- You can stop Ada's movement by
Ctrl-C
-ing the controller node started in step 7. - Never use the joystick while the controllers (step 7) are running. Both will fight over control of Ada and they will not care about collision boxes.
- Be familiar with the location of Ada's on/off-switch :)