Table Of Contents

Previous topic

Examples of Use

Next topic

Your First Scenario - attack an airport

This Page

How-to : MORSE and ROS

Pierrick Koch - GREYC - CNRS

anr-proteus.fr

Objectif: First step with ROS and MORSE.


ROS

Robot Operating System (ROS) can be seen as 2 main parts:

  • A communication middleware, with related APIs (C++, Python, Java),
  • A set of Robotic software (hardware abstraction, drivers, libs).

roscore: run a master node

roscore

TIP: to stop roscore: press Ctrl+C in the terminal

Basic commands:

roscd: change directory within ROS environment

Usage: roscd [package]

roslaunch: launching ROS nodes via .launch files

Usage: roslaunch [options] [package] <filename> [arg_name:=value...]

cf. Tutorials


rostopic

rostopic
rostopic is a command-line tool for printing information about ROS Topics.

Commands:
  rostopic bw    display bandwidth used by topic
  rostopic echo  print messages to screen
  rostopic find  find topics by type
  rostopic hz    display publishing rate of topic
  rostopic info  print information about active topic
  rostopic list  list active topics
  rostopic pub   publish data to topic
  rostopic type  print topic type

Type rostopic <command> -h for more detailed usage, e.g. 'rostopic echo -h'

rostopic: exemple

Publish & print a message on ROS bus:

rostopic pub /test std_msgs/String "Bonjour Proteus"
rostopic echo /test

|rostopic|


MORSE

Developped at LAAS/CNRS in Toulouse (France), MORSE is a generic robotic simulation platform based on Blender. Blender is a free and open source 3D modelisation platform. Which integrates differents methods for 3D rendering, animating, and a game engine used by MORSE for the simulation, as well as the physic engine Bullet. MORSE allow to build a robotic simulation by using Blender GUI / API.

Blender 2.5 introduced a new API allowing to interact with all scene-data through the Blender Python API, aka. bpy.

|blender-data-api|

|blender-roadmap|


MORSE

|morse|


MORSE GLSL

MORSE is meant to run with a graphic card compatible OpenGL Shading Language

ATI/AMD Radeon |AMD|

9x00, Xx00, X1x00, HD2x00, HD3x00 & +

sudo apt-get install `xserver-xorg-video-radeon <http://apt.ubuntu.com/p/xserver-xorg-video-radeon>`_

nVidia |nvidia|

Geforce FX, 6x00, 7x00, 8x00, 9x00, GTX 2x0 & +

sudo apt-get install `nvidia-current <http://apt.ubuntu.com/p/nvidia-current>`_

cf. Blender System Requirements Blender 2.48 Realtime GLSL Materials

Use the tool /usr/bin/jockey-gtk to install additional drivers. You can use lspci|grep VGA to know your card’s name.


MORSE config

right

right

metric

metric


MORSE & ROS

/Robot/Composant alphanumeric CamelCase

rostopic list -v

Published topics:
 * /ATRV/CameraMain [sensor_msgs/Image] 1 publisher
 * /rosout [rosgraph_msgs/Log] 1 publisher
 * /ATRV/Pose_sensor [nav_msgs/Odometry] 1 publisher
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /ATRV/Odometry [geometry_msgs/Twist] 1 publisher
 * /ATRV/Sick [sensor_msgs/LaserScan] 1 publisher

Subscribed topics:
 * /rosout [rosgraph_msgs/Log] 1 subscriber
 * /ATRV/Motion_Controller [geometry_msgs/Twist] 1 subscriber

MORSE CLI

Once installed, MORSE is launch by the command morse {check,edit,run} [scene], it accept differents parameters:

  • .blend file (simulation scene)
  • .py file (scene builder script)

ie:

morse edit my_builder_script.py

morse edit my_saved_scene.blend

... respectively result in:

  1. edit a scene build through a script in Blender GUI.
  2. edit a scene saved in a .blend file in Blender GUI.

MORSE: simulation loop

|morse-main-loop|



Demo: intro

robot made of one controler (v, ω)

!python
from morse.builder import *

# Add the robot
simplebot = Robot('atrv')

# Add a motion controler
motion = Actuator('v_omega')
motion.translate(z=0.3)
# Connect the controler to the robot
simplebot.append(motion)

# Configure the controler with the ROS middleware
motion.configure_mw('ros')

# Setup the environment
env = Environment('indoors-1/indoor-1')
env.aim_camera([1.0470, 0, 0.7854])

(code)


Demo: intro (2)

commands to run

start a ROS master node

roscore

start MORSE with a builder script (in another Terminal)

morse edit /usr/local/share/morse/examples/scenarii/ros_example.py
⌨ Press “P” in the 3D view to start the simulation (Game Engine)
⌨ Use “CTRL” + mouse, and “Z, Q/A, S, D/W” to move the camera

publish a message on the controler topic (in another Terminal)

rostopic pub -1 /ATRV/Motion_Controller geometry_msgs/Twist [1,0,0] [0,0,1]

Demo: intro (video)

(video)


Demo: advanced

obstacles avoidance w/ laser

mkdir -p ~/work/ros-addons
rosinstall ~/work/ros-addons /opt/ros/electric/ \
    http://anr-proteus.github.com/proteus.rosinstall
source ~/work/ros-addons/setup.bash
roscd proteus_demo && git pull && cd data
morse run wifibot.py

run the master node (in another Terminal)

roscore

launch our node to control the robot (in another Terminal)

source ~/work/ros-addons/setup.bash
roslaunch proteus_demo AvoidObstacleLaser.launch

TIP: if rosinstall is not recognized, install it as:

sudo pip install -U rosinstall

Demo: advanced (video)

(video)


Demo: advanced (code)

!python
# callback for each laser scan
def handle_sick(msg):
    mid = len(msg.ranges) // 2
    cmd = Twist()
    # stop if an object is less than 2m in a 30deg angle
    halt=False
    for distance_to_object in msg.ranges[mid-15:mid+15]:
        if distance_to_object < 2:
            halt=True
            break
    if halt:
        # rotate on the wider scanned side
        if sum(msg.ranges[:mid]) > sum(msg.ranges[mid:]):
            cmd.angular.z = -1
        else:
            cmd.angular.z = 1
    else:
        cmd.linear.x = 1
    # publie the command to the controler (Twist msg)
    topic.publish(cmd)

if __name__ == '__main__':
    rospy.init_node('wander')
    topic=rospy.Publisher('/ATRV/Motion_Controller', Twist)
    rospy.Subscriber('/ATRV/Sick', LaserScan, handle_sick)
    rospy.spin()

# http://ros.org/doc/api/sensor_msgs/html/msg/LaserScan.html
# http://ros.org/doc/api/geometry_msgs/html/msg/Twist.html

(code)


Demo: Orocos

The example’s code is available on GitHub

roscd proteus_demo/data
morse run wifibot.py

rosmake proteus_orocos_obstaclelaser
roslaunch proteus_orocos_obstaclelaser AvoidObstacleLaser.launch

|morse-orocos|


RViz (video)

rosrun rviz rviz

launch rviz with a configuration file

roscd proteus_demo/data
rosrun rviz rviz -d rviz.vcg

(video)


Outdoor (video)

roscd proteus_demo/data
morse run wifibot.py

(video)


Exploration (Bosch demo w/ Stage)

sudo apt-get install ros-electric-bosch-common
roslaunch explore_stage explore.launch

roscd explore_stage
rosrun rviz rviz -d explore.vcg

|exploration|


Exploration (Bosch demo w/ MORSE)


RTMaps

|rtmaps|


TIPS

MORSE create cache files in the current directory,

rm scene.*.blend

allow you to delete those files.

Resources

Blender Cookie: cgcookie.com/blender

Blend Swap: blendswap.com (ie. Rover model )

Blender Wiki: wiki.blender.org


Build a robot


That’s all Folks!

short link to this presentation: bit.ly/proteus2

proteus-morse-demo

1 page doc: bit.ly/proteus2md

sources on GitHub: bit.ly/proteus-src

made with landslide