Having a box move in gazebo at constant velocity using the Model Push Plugin [closed]

asked 2013-01-24 05:10:27 -0600

RebeccaK375 gravatar image

updated 2014-01-28 17:14:58 -0600

ngrennan gravatar image

Dear all,

I am trying to create a plugin that will have a box move at a constant velocity in gazebo, and I am using the following tutorials for reference:

Gazebo Plugin Intro - This tutorial worked for me

Model Manipulation Plugin - Used code from this tutorial to edit the files from the above tutorial, did not work

However, I get "the process has died out" error when I try to launch the world. I am doing something wrong, but what?

Plugin Code:

#include <boost/bind.hpp>
#include <gazebo.hh>
#include <physics/physics.hh>
#include <common/common.hh>
#include <stdio.h>

namespace gazebo
  class HelloWorld : public ModelPlugin
    public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) 
      // Store the pointer to the model
      this->model = _parent;

      // Listen to the update event. This event is broadcast every
      // simulation iteration.
      this->updateConnection = event::Events::ConnectWorldUpdateStart(
          boost::bind(&ModelPush::OnUpdate, this));

    // Called by the world update start event
    public: void OnUpdate()
      // Apply a small linear velocity to the model.
      this->model->SetLinearVel(math::Vector3(.03, 0, 0));

    // Pointer to the model
    private: physics::ModelPtr model;

    // Pointer to the update event connection
    private: event::ConnectionPtr updateConnection;

  // Register this plugin with the simulator

World File:

<?xml version="1.0"?> 
<gazebo version="1.0">
 <world name="default">

        <!-- Ground Plane -->


        <model name="box">
          <pose>0 0 0.5 0 0 0</pose>
          <link name="link">
            <collision name="collision">
                  <size>1 1 1</size>

            <visual name="visual">
                  <size>1 1 1</size>

          <plugin name="gazebo_tutorials" filename="libgazebo_tutorials.so"/>

CMakeLists file:

cmake_minimum_required(VERSION 2.4.6)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)


#set the default path for built executables to the "bin" directory
#set the default path for built libraries to the "lib" directory

#uncomment if you have defined messages
#uncomment if you have defined services

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})

rosbuild_add_library(gazebo_tutorials src/simple_world_plugin.cpp)

Launch File:

  <!-- set use_sim_time flag -->
  <param name="/use_sim_time" value="true" />
  <node name="gazebo" pkg="gazebo" type="gazebo" args="$(find gazebo_tutorials)/worlds/hello.world" respawn="false" output="screen"/>
  <node name="gazebo_gui" pkg="gazebo" type="gui" respawn="false" output="screen"/>

If you know your way around plugins, your help would be appreciated!

Thank you!

edit retag flag offensive reopen merge delete

Closed for the following reason Gazebo Question: The Gazebo community prefers to answer questions at: http://answers.gazebosim.org by tfoote
close date 2015-10-12 12:47:11.170937