Skip to content
Vincent Berenz edited this page Jul 30, 2018 · 7 revisions

playful

Playful is a software for robotic bevahior design. See : playful.is.tuebingen.mpg.de/

This repository shows examples of ROS turtlesim applications developed using Playful. It is mostly here to present an example of interfacing between ROS and Playful.

Useful to non-playful users: this repository also shows how to create a python API over ROS.

Requirements:

  • Ubuntu 64bits with ROS installed (any relatively recent version)
  • ROS turtlesim packages installed
  • Playful downloaded and in the $PATH (see tutorial)
  • Decent understanding of Python, ROS and Playful.

Turtlesim packages can typically be installed via (replace "kinetic" by the ros distro you use):

sudo apt-get install ros-kinetic-turtlesim*

To learn how to use Playful, including download, installation and tutorial, visit the wiki at:

https://github.com/vincentberenz/playful_tutorial/wiki

To get support: playful-support .at. tuebingen mpg de

playful_turtlesim has been tested on Ubuntu 14.04 running ROS indigo, and on Ubuntu 16.04 running ROS kinetic. Thanks for letting us know your result on other distros.

How to run an example

In a terminal, start turtlesim:

rosrun turtlesim turtlesim_node

In another terminal, go to the folder of the example you want to run and type 'playful execute'. For example:

cd playful_turtlesim/examples/run_after_in_turn

playful execute

To exit the application, press 'q'.

turtlesim

playful terminal

Overview of files

python libraries (not playful specific):

playful_turtlesim/py/turtlesim_wrapper.py :

A python interface for controlling turtlesim. It abstracts calls to publishers, subscribers and services. test_turtlesim_wrapper.py shows an example of usage.

playful_turtlesim/py/world.py :

Code for managing an "aquarium", i.e. a set of turtles moving randomly in the simulation. test_world.py for an example of usage

playful_turtlesim/py/robot.py

Code for a robot turtle which has limited battery life. Stops moving when battery reaches zero.

Playful libraries

playful_turtlesim/config

  • globals.py : create instances of a world with 3 turtles and a robot.
  • on_start.py : start the world and the robot
  • on_stop.py : stop the world and the robot
  • resources.txt : declaration of the playful resources "legs" (to go forward), "tail" (to turn) and "brush" (to set the color of the trail left by the robot)

playful_turtlesim/py

  • swimming_play.py : code for the playful nodes for swimming forward, turning, stopping and changing robot's brush's color

  • sensors_play.py : code that transform world scan (position of all turtles in the aquarium) into playful schemes which are pushed to the shared memory. Schemes are created based on the properties declared in properties_play.py

  • display_play.py : code for displaying in playful's terminal the current level of the robot's battery

  • filter_play.py : code for estimating the future position of the turtle in the aquarium in one seconde (based on current velocity), and pushing corresponding scheme in the shared memory

  • evaluations_play.py : code for various evaluations, e.g. measuring the distance between the robot and a turtle in the aquarium

playful_turtlesim/play

  • schemes.play : declaration of the two schemes used in the example applications. "target", which will refer to any turtle swimming in the aquarium, and "predicted_target" which corresponds to virtual objects at the position the turtle will be in a second (based on current velocity)

  • chase.play : playful code for the robot to reactively swim toward a (moving) object

Playful application examples

for each of these application, check the program ./play/program.play for related playful code.

playful_turtlesim/examples/moving_round

The robot applies a constant velocity.

playful_turtlesim/examples/move_to_target

The robot navigates to a fixed target.

playful_turtlesim/examples/run_after_closest

The robot navigates toward the closest "target" turtle (dynamically re-evaluated). When the battery gets to low, the robot redirects itself to the charger (at the bottom right of the aquarium, invisible) to recharge. Once recharged, it resumes its navigation. When navigating to a turtle, the robot does not aim at the turtle itself, but at the estimated position of the turtle one second in the future.

playful_turtlesim/examples/run_after_in_turn

Same as "run_after_closest", but instead of navigating to the closest turtle, it navigates to each turtle alternatively (switching every 10 seconds)