Skip to content

RDaneelOlivav/vector_ros

 
 

Repository files navigation

vector_ros

This repository contains an unofficial ROS package for Anki Vector that I started as a small side project after finishing several online ROS courses. This package is essentially a wrapping of core Vector functions from Vector Python SDK as ROS topics, services and actions(full list below). In order to showcase the package I wrote a simple red ball tracking node which subscribes to the camera feed coming from Vector, locates the red ball using cv_bridge/OpenCV and publish Twist messages to move the robot accurdenly as you can see in the following video:

Mentions

Setup

Requirements(non Docker setup)

Docker Image

It's highly recommended to use the supplied Dockerfile insted of installing directly on your machine mainly because of the tricky setup required to run Python 3 properly on ROS. If you wish to do this setup by yourself then I wrote a blog post explaining how that you can use, else follow these instructions:

  1. Install Docker and docker-compose if you dont have it already installed
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
  1. Clone this repository and create docker-compose file from template
git clone https://github.com/betab0t/vector_ros
cd vector_ros
cp docker-compose-TEMPLATE.yml docker-compose.yml
nano docker-compose.yml
  1. Edit the following lines and save
vector_ip: <VECTOR_IP>
vector_name: <VECTOR_NAME>
vector_serial: <VECTOR_SERIAL> 

Not sure how to get this info? see FAQ section below

  1. Build and start the container
sudo docker-compose build --build-arg anki_user_email=<ANKI_ACCOUNT_EMAIL> --build-arg anki_user_password=<ANKI_ACCOUNT_PASSWORD>
sudo docker-compose up

Use your Anki Developer username and password

Topics

  • /vector/camera (sensor_msgs/Image)

Vector camera feed.

  • /lwheel_ticks (std_msgs/Int32)

Cumulative encoder ticks of the left wheel. used by diff_drive package.

  • /rwheel_ticks (std_msgs/Int32)

Cumulative encoder ticks of the right wheel. used by diff_drive package.

  • /lwheel_rate (std_msgs/Int32)

Left wheel rotation rate. used by diff_drive package.

  • /rwheel_rate (std_msgs/Int32)

Right wheel rotation rate. used by diff_drive package.

Services

  • /vector/battery_state

  • /vector/set_head_angle

  • /vector/set_lift_height

  • /vector/anim_list

  • /vector/say_text

Actions

  • /vector/play_animation

Play animation by name.

Examples

View single image from camera

beta_b0t@home:~$ rosrun image_view image_saver image:=/vector/camera
[ INFO] [1550425113.646567813]: Saved image left0000.jpg
[ INFO] [1550425113.752592532]: Saved image left0001.jpg
[ INFO] [1550425113.848999553]: Saved image left0002.jpg
...
(Ctrl+C)
...
beta_b0t@home:~$ eog left0000.jpg

Set head angle

beta_b0t@home:~$ rosservice call /vector/set_head_angle "deg: 45.0"

Say text

beta_b0t@home:~$ rosservice call /vector/say_text "text: 'hello world'"

Play animation

beta_b0t@home:~$ rostopic pub /vector/play_animation/goal vector_ros/PlayAnimationActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  anim: 'anim_turn_left_01'"

FAQ

About

ROS package for Anki Vector home robot

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 65.4%
  • CMake 24.4%
  • Dockerfile 10.2%