Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 1.67 KB

README.md

File metadata and controls

57 lines (36 loc) · 1.67 KB

RTT Gazebo Embedded Component

Simple Gazebo stand alone object wrapped in an orocos component.

Design

A gazebo instance is launched with the RTTGazeboEmbedded component, which allows any components living in the same deployer to access the gazebo API (get world, model, time etc).

In your own TaskContext, you can (for example) bind those two functions :

gazebo::event::Events::ConnectWorldUpdateBegin(std::bind(&MyModel::WorldUpdateBegin,this));

gazebo::event::Events::ConnectWorldUpdateEnd(std::bind(&MyModel::WorldUpdateEnd,this));

And you'll get updates at each gazebo timestep. Take a look at the example/ component for a demo.

Tutorial

You can launch the demo in examples/ : cd examples; ./gz_test.ops

#!/usr/bin/env deployer

import("rtt_gazebo_embedded")

# Loading gazebo (this will start rosnode)
loadComponent("gazebo","RTTGazeboEmbedded")

# WorldUpdateBegin and End will be called by gazebo
setActivity("gazebo",0,10,ORO_SCHED_OTHER)

# This is optional
gazebo.argv = strings("--verbose")
# Load System Plugin for Clock-Sync
gazebo.add_plugin("libRTTGazeboClockPlugin.so")

gazebo.configure()

gazebo.start()

gazebo.toggleDynamicsSimulation(false)

# Loading the model
gazebo.spawn_model("kuka-lwr", "model://kuka-lwr-4plus", 10)

import("rtt-gazebo-lwr4plus-sim")
loadComponent("lwr_gazebo","lwr::LWR4plusSim")
setActivity("lwr_gazebo",0,11,ORO_SCHED_OTHER)
lwr_gazebo.misc.setUrdfPath(".../model.urdf")

lwr_gazebo.getModel("","kuka-lwr",4)
lwr_gazebo.configure()
gazebo.toggleDynamicsSimulation(true)