Skip to content

antonellabarisic/sphero_sprk_ros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sphero_sprk_ros

This repository contains a Pyhton driver for control and communication with Sphero SPRK+ within ROS. The purpose of this driver is to provide a platform for further research and development of custom applications for Sphero SPRK+ robot.

Example of use with Reynolds flocking algorithm can be found at https://github.com/mkrizmancic/sphero_formation

Note: The driver can be used without ROS.

Table of contents

Installation

sphero_sprk_ros was tested on Ubuntu 16.04/ROS Kinetic and Ubuntu 18.04/ROS Melodic running Python 2.7. Ubuntu 20.04/ROS Noetic running Python 3.8 is partially supported. For more details check out branch noetic-devel.

Due to BLE connection problems connected with kernel versions, we verified following versions of the kernel (the list is updated as new kernel versions are verified):

  • 4.4.0-21
  • 4.4.0-164
  • 5.0.0-23
  • 5.0.0-29 (Recommended)
  • 5.4.0-48 (Recommended)

Requirements

  • Ubuntu 16.04, Ubuntu 18.04 or Ubuntu 20.04
  • ROS Kinetic, ROS Melodic or ROS Noetic
  • Python 2.7 (full support) or Python 3.8+ (only sending commands, no data streaming)
  • bluepy (bluez)
    $ sudo apt install bluez
    $ pip install bluepy

Download and build

$ cd <path_to_your_catkin_ws>/src
$ git clone https://github.com/antonellabarisic/sphero_sprk_ros.git 
$ cd <path_to_your_catkin_ws>
$ catkin build
$ source <path_to_your_catkin_ws>/devel/setup.bash

Important note:
If catkin build doesn't work on your system, you can use catkin_make. However, these tools are not interchangeable. Once the workspace is build using one of them, the other can't be used in that workspace.

Usage

Simple launch file for one Sphero SPRK+ is provided. You need to specify MAC address of Sphero, custom name and parameter data_stream ("All" or "Locator").

roslaunch sphero_sprk_ros one_sphero.launch

You can easily add multiple robots to launch file or use:

roslaunch sphero_sprk_ros drivers.launch

In the second launch file, you specify the number of Sphero roboots. The first n addresses from cfg/sphero_addresses.txt will be used to launch n nodes. If n=1, both launch files are equivalent.

Package description

Subscribed topics

  • /sphero_0/cmd_vel
    • Type: geometry_msgs/Twist
  • /sphero_0/set_color
    • Type: std_msgs/ColorRGBA
  • /sphero_0/set_heading
    • Type: std_msgs/Float32
  • /sphero_0/set_angular_velocity
    • Type: std_msgs/Float32
  • /sphero_0/disable_stabilization
    • Type: std_msgs/Bool
  • /sphero_0/manual_calibration
    • Type: std_msgs/Bool

Published topics

  • /sphero_0/imu
    • Type: sensor_msgs/Imu
  • /sphero_0/odom
    • Type: nav_msgs/Odometry
  • /sphero_0/diagnostics
    • Type: diagnostic_msgs/DiagnosticArray

Scope of functionalities

  • connect, ping, sleep, disconnect
  • roll
  • set_power_notify
  • get_power_state
  • get_device_name
  • set_rgb_led
  • set_back_led
  • set_stabilization
  • set_heading
  • set_filtered_data_strm
  • set_locator
  • read_locator

About

A ROS driver for Sphero SPRK+.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published