TurtleBot2&ROS - Simulationsspanel/ROSWorkshop2013/1_5 ROS_simulations.pdf · ROS/Gazebo URDF...

Preview:

Citation preview

TurtleBot2&ROS - SimulationsIng. Zdeněk Materna

Department of Computer Graphics and MultimediaFakulta informačních technologií

VUT v Brně

TurtleBot2&ROS - Simulations 1 / 22

Presentation outline

Introduction

ROS/Gazebo

URDF

Gazebo / URDF practise

TurtleBot2&ROS - Simulations 2 / 22

Introduction

TurtleBot2&ROS - Simulations 3 / 22

Motivation

"In theory, there is no difference between theory and practice. But,in practice, there is."

Jan L. A. van de Snepscheut

TurtleBot2&ROS - Simulations 4 / 22

Motivation

Advantages of simulation for development and research in mobilerobotics field:

• Testing in simulation can save time and thus money.• More developers can work at the same time, on different

places.• Simulation can provide highly controlled and structured

environment.• Repeatable tests (important for debugging).

TurtleBot2&ROS - Simulations 5 / 22

Motivation

However...• Simulation can only approximate the real world.• There may be high risk and uncertainty during the transfer

from simulation to real world experiment.• Things which works good in simulation may completely fail in

real world.• Real environments are complex, unstructured and

unpredictable.• Simulation is only as good as it’s models.

TurtleBot2&ROS - Simulations 6 / 22

Physics based simulations

• Rigid body dynamics (joints, links), collision detection.• Solves forward dynamics problem (forces, motion of system).• Numerical integration (stability, time-step).• Constraints (revolute, prismatic, spherical).• Material properties (e.g. friction).• Engines: ODE, Bullet, PhysX, Unreal engine (USARSim).

TurtleBot2&ROS - Simulations 7 / 22

ROS/Gazebo

TurtleBot2&ROS - Simulations 8 / 22

Overview

• Gazebo - general purpose 3D simulator.• Both indoor / outdoor environments, multi-robot.• Uses ODE (physics), OGRE (rendering).• Produces same data as real robot (topics, services).• Same interface of simulated and real robot → no need to

rewrite software.• Special interface to control simulation.• Other simulators - OpenRave, Grasp It!, Webots and many

more.

TurtleBot2&ROS - Simulations 9 / 22

Models

• A lot of available models, robots (list).• PR2, Robonaut, Care-O-Bot

• Robot models are created using XML (URDF).• Common sensors (camera, LIDAR, Kinect, force sensors).

TurtleBot2&ROS - Simulations 10 / 22

What must be considered• Simulation may not run in real-time.• A lot of parameters to set. . .• Not all physical phenomenas are modelled.• Limited correspondence to real world experiment.• Simulated time means higher load.

0

20000

40000

60000

80000

100000

120000

930 940 950 960 970 980

coun

ts

distance [mm]

Histogram (mean: 950 mm)

TurtleBot2&ROS - Simulations 11 / 22

TB2 simulation

• Based on simulation of TurtleBot.• Let’s try to run it!

r o s l a un ch btb_gazebo robot_empty_world . l aunch

TurtleBot2&ROS - Simulations 12 / 22

URDF

TurtleBot2&ROS - Simulations 13 / 22

Overview

• XML robot description format.• Robot kinematics, dynamics, sensors, scenes.• Xacro - macro language.• Usually uploaded to parameter server (i.e. robot_description).• URDF example link.

<?xml v e r s i o n ="1.0"?><robot name="my f i r s t ">

<l i n k name="ba s e_ l i n k "><v i s u a l >

<geometry><c y l i n d e r l e n g t h ="0.6" r a d i u s ="0.2"/>

</geometry></v i s u a l >

</ l i n k ></robot>

TurtleBot2&ROS - Simulations 14 / 22

Structure - links and joints• links

• name, inertial, visual, collision• joints

• name, type (fixed, planar, revolute etc.), parent, child, axis• All values are in SI (meters, kilograms), rotation uses RPY

(apart from TF).• For simulation, we need to specify physical properties for all

links.

TurtleBot2&ROS - Simulations 15 / 22

Tools

• Xacro - kind of preprocessing• Verification - check syntax etc.• Visualisation - create pdf for better understanding.

r o s r un xac ro t e s t_xa c r o . py t u r t l e b o t . u r d f . xac ror o s r un xac ro xac ro . py t u r t l e b o t . u r d f . xac ro \\> t u r t l e b o t . u r d fr o s r un u r d f check_urd f t u r t l e b o t . u r d fr o s r un u r d f_pa r s e r u rd f_to_graph i z t u r t l e b o t . u r d fe v i n c e btb . pdf

TurtleBot2&ROS - Simulations 16 / 22

Relation with TF

• Robot model is used to broadcast TF transforms.• The robot_state_publisher uses URDF model and

joint_states to get 3D poses of robot links.

TurtleBot2&ROS - Simulations 17 / 22

Robot / Joint state publisher

• Go through joint_state_pub.launch• Try to visualise URDF model in RVIZ and manipulate with

joints:

r o s l a un ch tb2_workshop_s imu la t i ons \\j o i n t_ s t a t e_pub . l aunch

TurtleBot2&ROS - Simulations 18 / 22

Gazebo / URDF practise

TurtleBot2&ROS - Simulations 19 / 22

Using URDF with Gazebo

• Physical properties of joints and links must be specified.• Model can be "spawned"from command line:

r o s l a un ch gazebo_wor lds empty_world . l aunchro s cd tb2_workshop_s imu la t i onsr o s r un gazebo spawn_model − f i l e \\. / u r d f / t u r t l e b o t . u r d f −u r d f −z 0 .1 −model btb

• Spawning from launch file - see btb_gazebo package.

TurtleBot2&ROS - Simulations 20 / 22

Gazebo services and topics

r o s s e r v i c e l i s t | g rep gazebor o s t o p i c l i s t

• Services for getting / setting state of simulation.• Getting position of robot:

r o s s e r v i c e c a l l / gazebo / get_mode l_state \\’{model_name : btb } ’

• More examples (link).

TurtleBot2&ROS - Simulations 21 / 22

Thanks for your attention

TurtleBot2&ROS - Simulations 22 / 22

Recommended