Gazebo | Ignition | Community
Ask Your Question

djou07's profile - activity

2020-10-21 00:36:58 -0500 marked best answer Ignore collision between specific models

Hi,

Is there a way to ignore collision between two objects ? Like an object passes through another specific object, but keeps the collision with the environment (other models and ground).

Thanks in avdance :)

2020-06-20 04:14:57 -0500 received badge  Taxonomist
2017-09-21 08:36:36 -0500 received badge  Famous Question (source)
2017-08-16 01:01:32 -0500 received badge  Popular Question (source)
2017-08-16 01:01:32 -0500 received badge  Notable Question (source)
2017-08-16 01:01:32 -0500 received badge  Famous Question (source)
2017-07-13 04:13:24 -0500 commented answer Does gazebo simulate modular robots ?

yes i did succeed on simulating modular robots, you only have to take into account the number of modules, because the mo

2017-07-13 04:11:40 -0500 commented answer Does gazebo simulate modular robots ?

yes i did succeed on simulating modular robots, you only have to take into account the number of modules, because the mo

2017-06-29 01:39:47 -0500 asked a question I get different ray sensor data at each run (How to get exactly the same?)

I get different ray sensor data at each run (How to get exactly the same?) Hi, Is there a way to retrieve ray sensor d

2017-06-19 03:18:52 -0500 received badge  Famous Question (source)
2017-01-26 16:31:48 -0500 received badge  Famous Question (source)
2016-12-09 04:41:07 -0500 marked best answer unable to parse message of type [...] error in custom message

Hello,

I am trying to send a custom message from a model plugin to another model plugin. The two plugins are linked to same model. The code compiles well, but when I run gazebo GUI it shows me this error in topic visualisation:

unable to parse message of type[robot_brain_fitness_msgs.msgs.robotDataRequest]

I do not why, can you guys help me...thanks in advance :)

here is the source code


in subfolder msgs

/msgs/robot_brain_fitness.proto

package robot_brain_fitness_msgs.msgs;
message robotDataRequest
{
   required double fitness = 1; 
}

/msgs/CMakeLists.txt

find_package(Protobuf REQUIRED)
set(PROTOBUF_IMPORT_DIRS)
foreach(ITR ${GAZEBO_INCLUDE_DIRS})
  if(ITR MATCHES ".*gazebo-[0-9.]+$")
    set(PROTOBUF_IMPORT_DIRS "${ITR}/gazebo/msgs/proto")
  endif()
endforeach()
set (msgs
  robot_brain_fitness.proto
  ${PROTOBUF_IMPORT_DIRS}/vector2d.proto
  ${PROTOBUF_IMPORT_DIRS}/header.proto
  ${PROTOBUF_IMPORT_DIRS}/time.proto
)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${msgs})
add_library(robot_brain_fitness_msgs SHARED ${PROTO_SRCS})
target_link_libraries(robot_brain_fitness_msgs ${PROTOBUF_LIBRARY})

in root folder

plugin1.cc

#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <stdio.h>
#include <iostream>
#include "robot_brain_fitness.pb.h"

namespace gazebo
{   

typedef const boost::shared_ptr
    <const robot_brain_fitness_msgs::msgs::robotDataRequest>   robotDataRequestPtr;


    class ReceiveMsgPlugin : public ModelPlugin
    {

    private: event::ConnectionPtr updateConnection;
             physics::ModelPtr model;
             transport::SubscriberPtr subscriber;
             transport::NodePtr node;

    public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) 
    {    
        //subscriber = node->Subscribe("~/robotData", &ReceiveMsgPlugin::create, this);

        this->updateConnection = event::Events::ConnectWorldUpdateBegin
            ( boost::bind(&ReceiveMsgPlugin::OnUpdate, this, _1));
    }
    /*public: void create(robotDataRequestPtr &msg)
    {
        std::cout << "fitness : " <<msg->fitness() << "\n";

    }*/     
    public: void OnUpdate(const common::UpdateInfo & /*_info*/)
    {

    }
};
 GZ_REGISTER_MODEL_PLUGIN(ReceiveMsgPlugin)
 }

plugin2.cc

#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <stdio.h>
#include <iostream>
#include "robot_brain_fitness.pb.h"

namespace gazebo
{   
 class SendMsgPlugin : public ModelPlugin
 {
private: event::ConnectionPtr updateConnection;
         physics::ModelPtr model;
         transport::PublisherPtr publisher;
         transport::NodePtr node;

   public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) 
   {
    this->model = _parent;

     node = transport::NodePtr(new transport::Node());

     node->Init(this->model->GetWorld()->GetName());

     this->updateConnection = event::Events::ConnectWorldUpdateBegin
        ( boost::bind(&SendMsgPlugin::OnUpdate, this, _1));

   }

    public: void OnUpdate(const common::UpdateInfo & /*_info*/)
    {
        robot_brain_fitness_msgs::msgs::robotDataRequest request;
        request.set_fitness(10);
        publisher = node->Advertise
          <robot_brain_fitness_msgs::msgs::robotDataRequest>("~/robotData");
        publisher->Publish(request);
    }
};
GZ_REGISTER_MODEL_PLUGIN(SendMsgPlugin)  
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
FIND_PACKAGE( Boost 1.40 COMPONENTS system REQUIRED )
set (CMAKE_CXX_FLAGS "-g -Wall")

include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
  pkg_check_modules(GAZEBO gazebo)
  pkg_check_modules(SDF sdformat)
endif()

include_directories(
  ${GAZEBO_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR}/msgs
  )
link_directories(${GAZEBO_LIBRARY_DIRS} ${SDF_LIBRARY_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/msgs)
add_subdirectory(msgs)

add_library(plugin1 SHARED plugin1.cc)
target_link_libraries(plugin1 robot_brain_fitness_msgs 
${Boost_LIBRARIES} ${GAZEBO_LIBRARIES} ${SDF_LIBRARIES})
add_dependencies(plugin1 robot_brain_fitness_msgs)

add_library(plugin2 SHARED plugin2.cc)
target_link_libraries(plugin2 robot_brain_fitness_msgs ${Boost_LIBRARIES}
${GAZEBO_LIBRARIES} ${SDF_LIBRARIES})
add_dependencies(plugin2 robot_brain_fitness_msgs)
2016-11-02 02:14:34 -0500 received badge  Famous Question (source)
2016-10-24 11:16:32 -0500 received badge  Notable Question (source)
2016-10-24 04:48:17 -0500 answered a question joint damping has no effect

I removed the joint limite and it workd !! can someone explain why...

<limit>
    <lower>0.5</lower>
    <upper>-0.5</upper>
</limit>
2016-10-22 01:51:12 -0500 commented question joint damping has no effect

it is the same behaviour if I set damping to 0 or 10 or 100.... I have deferent robot shapes that I generate randomly, sometimes the robot is heavy and the force applied to the joint is big (30Nm) so robot starts to fly and bounce. I want whenever big is the force, the joint moves slowly but strong enought to lift other robot parts...I hope I well explained what I want.

2016-10-22 01:43:29 -0500 received badge  Popular Question (source)
2016-10-21 08:01:21 -0500 received badge  Famous Question (source)
2016-10-21 02:31:14 -0500 commented question joint damping has no effect

sorry, it was a typo...I'll correct it, still doesn't work!

2016-10-20 09:09:26 -0500 asked a question joint damping has no effect

Hi there,

damping has no effect to avoid bouncing and flying of robots.I want to do like this but It doesn't work for me!

here is my SDF file. with a force of 0.051Nm and what ever damping value I set, alwayes the same behaviour.

<?xml version='1.0' ?>
<sdf version='1.4'>
<world name="default">
 <include>
   <uri>model://ground_plane</uri>
 </include>
<include>
   <uri>model://sun</uri>
 </include>
 <model name='0'>
<link name='1'>
    <pose>0.00503991 0.00855352 0.0245165 0 4.71239 0</pose>
    <inertial>
        <mass>0.05</mass>
        <inertia><ixx>0.000003333</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.000004271</iyy>
            <iyz>0</iyz><izz>0.000004271</izz>
        </inertia>
    </inertial>
    <collision name='collision'>
        <geometry>
            <box>
                <size>0.0125 0.01 0.01</size>
            </box>
        </geometry>
    </collision>
    <visual name='visual'>
        <geometry>
            <box>
                <size>0.0125 0.01 0.01</size>
            </box>
        </geometry>
    </visual>
</link>

<link name='2'>
    <pose>0.00503991 0.00855352 0.0370165 0 4.71239 0</pose>
    <inertial>
        <mass>0.05</mass>
        <inertia><ixx>0.000003333</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.000004271</iyy>
            <iyz>0</iyz><izz>0.000004271</izz>
        </inertia>
    </inertial>
    <collision name='collision'>
        <geometry>
            <box>
                <size>0.0125 0.01 0.01</size>
            </box>
        </geometry>
    </collision>
    <visual name='visual'>
    <geometry>
        <box>
            <size>0.0125 0.01 0.01</size>
        </box>
        </geometry>
    </visual>
</link>

<joint type="revolute" name="0_1">
    <pose>-0.00625 0 0 0 0 0</pose>
    <child>1</child>
    <parent>2</parent>
    <axis>
        <xyz>0 0 1</xyz>
        <limit>
            <lower>0.5</lower>
            <upper>-0.5</upper>
        </limit>
        <dynamics>
            <friction>0.05</friction>
            <damping>1000000000000000000000000000000000000000000000000000</damping>
        </dynamics>
    </axis>
    <physics>
        <ode>
            <implicit_spring_damper>1</implicit_spring_damper>
        </ode>
    </physics>
</joint>
<plugin name="controller" filename="build/libcontroller.so"/>
</model>
</world>
</sdf>

I have Gazebo version 6.1.0

2016-10-18 08:06:33 -0500 commented question Getting different behaviours of the same robot that I launch in two different configurations

I solved this by saving the position of all links at each time step in the remote machine, and reproduce the behaviour in my local machine (by seting saved positions)

2016-10-18 02:33:59 -0500 commented answer same simulation but different behaviors in remote and local machine

im not using ROS. I tried to save the position of all links at each time step in remote machine, and reproduce the behaviour in my local machine (by seting saved positions) and it workd.... thanks

2016-10-18 02:31:20 -0500 received badge  Notable Question (source)
2016-10-16 20:36:43 -0500 received badge  Popular Question (source)
2016-10-12 03:34:57 -0500 received badge  Notable Question (source)
2016-10-12 03:33:33 -0500 asked a question same simulation but different behaviors in remote and local machine

Hi all,

I run my simulation in a remote server (no GPU). So I can't see what behaviour my robots do visually. When I reproduce the simulation in my machine I get totally different behavior.

How can I do?

2016-09-26 02:42:43 -0500 received badge  Popular Question (source)
2016-09-25 10:09:36 -0500 received badge  Self-Learner (source)
2016-09-24 09:33:59 -0500 answered a question how to retrieve contact data from engine (NOT MESSAGE)!

The solution is to use ContactManager classe

physics::ContactManager *contactManager =
 this->model->GetWorld()->GetPhysicsEngine()->GetContactManager();

for(int i=0; i<contactManager->GetContactCount(); i++)
{
    physics::Contact *contact = contactManager->GetContact(i);
    cout << "contact between "<<contact->collision1->GetLink()->GetName()<<" and "
    << contact-> collision2-> GetLink()->GetName() <<endl;          
}
2016-09-22 04:41:52 -0500 asked a question how to retrieve contact data from engine (NOT MESSAGE)!

how to retrieve contact data directly from physic engine (not in a message).

I tried to use the map structure but this function also use messages.

sensors::SensorPtr sensor = sensors::SensorManager::Instance()->GetSensor(this->model->GetLink("0")->GetSensorName(0));

sensors::ContactSensorPtr contactSensor = boost::dynamic_pointer_cast<sensors::ContactSensor>(sensor);

std::map<string, physics::Contact> contacts = contactSensor->GetContacts(this->contactSensor->GetCollisionName(0));

for (std::map<string, physics::Contact>::iterator iter = contacts.begin();iter != contacts.end(); ++iter)
{
       <<"count       " << iter->second.count <<endl
       <<"time        " << iter->second.time <<endl;
}

The probleme with messages, it may miss some data. I want that each time I run the simulation I get the same data sequence, but this is not the case. For instance look at this curves; data in the first run are different from the second even if its the same simulation image description image description

2016-08-24 21:49:38 -0500 marked best answer send arguments from system plugin to model plugin ?

Hello,

How to send a message from a system plugin to a model plugin. I tried this code but it doesn't work:

I want to send arguments to the model plugin. And I run this plugin in server side.

#include <gazebo/math/Rand.hh>
#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <iostream>

using namespace std;
namespace gazebo
{
  typedef const boost::shared_ptr<const msgs::Vector2d> VectorTwoDPtr;

  class CommandLine : public SystemPlugin
  {
    public: void Load(int argc, char ** argv)
    {
      for(int i =0; i<argc; i++)// I want to send the arguments to the model plugin
        cout << argv[i] << endl;
      this->connections.push_back( event::Events::ConnectPreRender( boost::bind(&CommandLine::Update, this)));
     }

private: void Init()
{
  transport::NodePtr nodePub = transport::NodePtr(new transport::Node());
  nodePub->Init();
  transport::PublisherPtr  publisher = nodePub->Advertise<msgs::Vector2d>("~/robotName");

  math::Vector2d vect( 2, 1);   
  msgs::Vector2d msg;
  msgs::Set(&msg, vect);
  publisher->Publish(msg);
}
private: void Update()
{
  // the onUpdate don't work 
}
private: std::vector<event::ConnectionPtr> connections;
  };
  GZ_REGISTER_SYSTEM_PLUGIN(CommandLine) 
}

THANK YOU !

2016-08-24 21:49:38 -0500 received badge  Self-Learner (source)
2016-08-24 21:49:38 -0500 received badge  Teacher (source)
2016-08-17 14:51:53 -0500 received badge  Notable Question (source)