Objectif: First step with ROS and MORSE.
Robot Operating System (ROS) can be seen as 2 main parts:
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 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'
Publish & print a message on ROS bus:
rostopic pub /test std_msgs/String "Bonjour Proteus"
rostopic echo /test
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.
MORSE is meant to run with a graphic card compatible OpenGL Shading Language
sudo apt-get install `xserver-xorg-video-radeon <http://apt.ubuntu.com/p/xserver-xorg-video-radeon>`_
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.
/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
Once installed, MORSE is launch by the command morse {check,edit,run} [scene], it accept differents parameters:
ie:
morse edit my_builder_script.py
morse edit my_saved_scene.blend
... respectively result in:
!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)
roscore
morse edit /usr/local/share/morse/examples/scenarii/ros_example.py
rostopic pub -1 /ATRV/Motion_Controller geometry_msgs/Twist [1,0,0] [0,0,1]
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
roscore
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
!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)
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
sudo apt-get install ros-electric-bosch-common
roslaunch explore_stage explore.launch
roscd explore_stage
rosrun rviz rviz -d explore.vcg
MORSE create cache files in the current directory,
rm scene.*.blend
allow you to delete those files.
Blender Cookie: cgcookie.com/blender
Blend Swap: blendswap.com (ie. Rover model )
Blender Wiki: wiki.blender.org
short link to this presentation: bit.ly/proteus2
1 page doc: bit.ly/proteus2md
sources on GitHub: bit.ly/proteus-src
made with landslide