Gazebo | Ignition | Community
Ask Your Question

Francis123's profile - activity

2017-12-04 11:14:28 -0600 received badge  Notable Question (source)
2017-12-04 11:14:28 -0600 received badge  Famous Question (source)
2017-12-04 11:14:28 -0600 received badge  Popular Question (source)
2017-05-19 03:48:19 -0600 received badge  Famous Question (source)
2017-05-03 11:51:58 -0600 received badge  Popular Question (source)
2017-05-03 11:51:58 -0600 received badge  Notable Question (source)
2017-04-28 12:45:24 -0600 received badge  Nice Question (source)
2017-03-16 09:58:47 -0600 received badge  Famous Question (source)
2017-01-31 13:52:38 -0600 received badge  Self-Learner (source)
2017-01-31 13:52:38 -0600 received badge  Teacher (source)
2017-01-31 13:50:00 -0600 answered a question Gazebo node cannot see Gazebo Topic, need help understanding why

I was able to figure out why my standalone gazebo program and gazebo plugin were having problems communicating with each other.

It was all on the the standalone gazebo program side, and I used this link to help me understand where I went wrong.

For the problem of publishing messages to a gazebo topic Basically I was missing these two lines before initializing the gazebo transport node (something that is not used in another tutorial I used)


For the problem of subscribing to a gazebo topic through the standalone gazebo program, I had to create a shared boost ptr to the object that is passed as a parameter to the callback function

typedef const boost::shared_ptr<gazebo::msgs::Vector3d> ConstVector3dPtr;

In the future it might be helpful if there were tutorials that are soley about creating standalone gazebo programs, I did find the answers but through a lot of assumptions.

2017-01-30 10:58:55 -0600 received badge  Notable Question (source)
2017-01-27 13:12:49 -0600 commented answer Gazebo node cannot see Gazebo Topic, need help understanding why

However the gazebo plugin cannot publish to topic B, and I have no idea why,

2017-01-27 13:12:49 -0600 received badge  Commentator
2017-01-27 13:12:11 -0600 commented answer Gazebo node cannot see Gazebo Topic, need help understanding why

I tired using the command you suggested, but I keep getting an error saying is a invalid type of identifier. Obviosuly I replace with my world. Aside from that I dont think that the port is what is causing this problem I created a simple version of standalone program and gazebo plugin and posted it above. What I found was that the standalone program was able to publish to the topic a, and the gazebo plugin was able to see see the message

2017-01-27 11:50:13 -0600 commented question Gazebo node cannot see Gazebo Topic, need help understanding why

I added the code to the question now. So basically what I see now is the stand alone can publish to topic a, but the gazebo plugin cannot publish to topic b, any ideas?

2017-01-27 10:26:41 -0600 commented question Gazebo node cannot see Gazebo Topic, need help understanding why

I can show small portions though. Here is my subscriber for topic a in one gazebo node sub1 = node->Subscribe("/gazebo/torqueprofile/feedback", callback_from_gazebo); Here is my code for the publisher for "topic a" in the gazebo control plugin pub1 = node->Advertise<gazebo::msgs::vector3d>("/gazebo/torqueprofile/feedback"); They are identical name definition

2017-01-27 10:23:00 -0600 received badge  Popular Question (source)
2017-01-27 10:22:41 -0600 commented question Gazebo node cannot see Gazebo Topic, need help understanding why

I also added the call pub1->WaitForConnection(); before each message that I publish over the gazebo transport layer, before I just called it after defining the gazebo publisher handle. I am using Gazebo 7, and cannot show code due to employment restrictions.

2017-01-27 10:20:06 -0600 commented question Gazebo node cannot see Gazebo Topic, need help understanding why

I made sure there was no typo in the topic name. Also i am able to see both the publisher and the subscriber to the topic so that confirms that the gazebo nodes are looking at the topic. I did find this page to be helpful ( It made it clear that in my gazebo node executable (that uses int main()) I needed to make a call to these two transport functions: gazebo::transport::init(); gazebo::transport::run();

2017-01-25 16:28:53 -0600 answered a question cmd_vel not working with custom plugin

I believe the problem is that you are not creating a ROS node& ROS subscriber within your gazebo control plugin.

This tutorial should explain how to connect to ROS within a gazebo node. AKA create a ROS node and ROS subscriber object to connect to the ROS callback function you have defined ("ROSCallback_Vel")

2017-01-25 16:11:59 -0600 asked a question Gazebo node cannot see Gazebo Topic, need help understanding why

I used this tutorial to get me going

It gave me enough information to create a gazebo model plugin, and a standalone gazebo node that would use a gazebo transport node to publish commands to a Gazebo topic.

My problem is that my gazebo model plugin is unable to see when a message is sent to the gazebo topic ("/topic/a") even though I have a gazebo subscriber callback function for "/topic/a". To confirm that I was publishing and subscribing to the gazebo topic I opened a terminal and used the command

"gz topic -i /topic/a"

The response was

Type: gazebo.msgs.Vector3d

    Same IP:43457

    Same IP:45557

They had the same IP but different ports. Is that normal? How do I get both gazebo nodes to look at the same Gazebo topic?

My code for my standalone is below

#include <gazebo/gazebo_client.hh>
#include <gazebo/common/common.hh>
#include <gazebo/gazebo_config.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/transport.hh>
#include <gazebo/msgs/msgs.hh>

void callback_from_gazebo(ConstVector3dPtr &_msg) {   std::cout << "Callback received () \n"; }

int main(int _argc, char **_argv) {     std::cout << "Gazebo Initialization \n";
    gazebo::transport::PublisherPtr pub1,pub2;
    gazebo::transport::SubscriberPtr sub1;

    gazebo::client::setup(_argc, _argv);

    gazebo::transport::NodePtr node(new gazebo::transport::Node());
    std::cout << "End Gazebo Initialization \n";

    std::cout << "Define Gazebo Publishers and Subscribers \n";
    pub1 = node->Advertise<gazebo::msgs::Vector3d>("/topic/a");
    pub2 = node->Advertise<gazebo::msgs::WorldControl>("/gazebo/torqueprofile/world_control");
    sub1 = node->Subscribe("/topic/b", callback_from_gazebo);

    std::cout << "Waiting for connection\n";
    std::cout << "Connections confirmed\n";

        gazebo::msgs::Vector3d cmd;

        gazebo::msgs::WorldControl world_msg;


    return 0; }

My code for my plugin is below

#include <boost/bind.hpp>
#include <gazebo/transport/transport.hh>
#include <gazebo/msgs/msgs.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <gazebo/math/Angle.hh>
#include <gazebo/gazebo_client.hh>
#include <gazebo/gazebo_config.h>
#include <stdio.h>
#include <fstream>

namespace gazebo
  /// \brief A plugin to control two cubes strictly in Gazebo
  class gazebo_simple_plugin : public ModelPlugin
    /// \brief Constructor
    public: gazebo_simple_plugin() 

    public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
        model = _model;

        if (model->GetJointCount() == 0)
            std::cerr << "\n no joints \n";
            std::cerr << "\n joints are there \n";

        //set joint handle to joints in the _model
        joint1 = model->GetJoints()[0]; 

        // Create the Gazebo node
        node = transport::NodePtr(new transport::Node());

        pub1 = node->Advertise<gazebo::msgs::Vector3d>("/topic/b");
        sub1 = node->Subscribe("/topic/a", &gazebo_simple_plugin::callback_from_standalone, this);

        //Listen to the update event. This event is broadcast every
        updateConnection = event::Events::ConnectWorldUpdateBegin(boost::bind(&gazebo_simple_plugin::OnUpdate, this, _1));


    private: void callback_from_standalone(ConstVector3dPtr &_msg)
      printf("cmd received ...
2017-01-20 11:15:57 -0600 commented answer simulink model as GAZEBO plugin

^ Adding to the previous comment, if anyone has figured a way to get passed needing to use libgdal with gazebo on a ubuntu installation please give some insight :)

2017-01-20 11:15:07 -0600 commented answer simulink model as GAZEBO plugin

I can say first hand, that trying to use gazebo functionality within a S-function will not work. At run time the library will have a couple undefined symbols to a library (cannot remember the name lets call it and you cannot symbolically link to from an external directoy that can resolve the undefined symbol because already exists within the matlab directory and it has slightly different definitions that are needed by other libraries within matlab.

2016-12-15 12:31:36 -0600 received badge  Enthusiast
2016-11-16 16:54:34 -0600 received badge  Editor (source)
2016-11-16 16:53:50 -0600 received badge  Organizer (source)
2016-11-16 16:52:26 -0600 asked a question Contact sensor not sensing collisions in Bullet Physics engine


So I am having problems running tests using the Bullet physics engine through Gazebo. Initially I set up a world with the ODE physics engine, a block model with a contact sensor and another block model both floating in space. I created a model plugin that pushed the block with the contact sensor towards the other block, once the blocks collied I got data from the contact sensor. Now I have set up a world file with these physics properties

<physics type="bullet">
            <gravity> 0.0 0.0 0.0</gravity>

Keeping everything else the same, and for some reason when the blocks collide I do not get any information from my contact sensor with regards to a collision occurring. Its as if nothing happened, however visually the models bounce of each other since they are floating in space.

I was hoping maybe some one could explain to me why I am getting no data. Could it be because of my physics properties? Or could it be because my control plugin doesnt have something set with respect to Bullet? I would assume the the control plugin used to detect collision when running the program in ODE should also work in Bullet.

Any help would be greatly appreciated :)

Thanks Francis123

2016-11-16 15:02:12 -0600 asked a question How to calculate surface area based on points of contact from a contact sensor

Currently I a have world file that consists of a simple gripper and a t-handle shape floating in space. In the definitions for the models I defined contact sensors for each link that I wanted to detect collisions on of the simple gripper. Finally I wrote a model control plugin that accessed the simple gripper model, used gazebo subscriber callback functions to look at contact data from the different contact sensors, and I am able to look at each collision and the points of contact based of that collision. Similarly as this tutorial describes (

My questions are the following?

  1. Is there any pre-made functionality to calculate surface area of the collision as opposed to just looking at points of contact?
  2. Does each gazebo callback definition automatically create a separate thread to act asynchronously, because I have no understanding on whether all the callback queues and other functions are all running through one thread, versus multiple threads.
  3. Are there better sensors for detecting collisions on a gripper, versus a contact sensor?

Thanks Francis123

2016-11-16 14:36:22 -0600 received badge  Famous Question (source)
2016-10-31 13:13:22 -0600 received badge  Student (source)
2016-10-28 13:48:12 -0600 received badge  Supporter (source)
2016-10-27 12:18:58 -0600 received badge  Scholar (source)
2016-10-26 09:08:35 -0600 received badge  Notable Question (source)
2016-10-24 11:33:52 -0600 commented answer Made a 7 dof robot arm in Gazebo. Want the joints for the arm to act like electric motors and not free fall

Ok, looking through the tutorials for control model plugins in Gazebo ( I do not see a use case for gazebo::msgs::JointCmd. But can I assume that if I create a Gazebo node (in c++) to publish commands using that message type I do not have to write a gazebo control plugin in c++? For the Matlab side there is a way to convert the functions into c++ programs so the torque outputs can be handled by the gazebo control plugin.

2016-10-24 11:16:02 -0600 received badge  Popular Question (source)
2016-10-24 10:08:29 -0600 commented answer Made a 7 dof robot arm in Gazebo. Want the joints for the arm to act like electric motors and not free fall

Thanks Peter for the advice. What I am trying to validate are contact dynamics in Gazebo while passing torque based commands using Matlab. I am familiar with ROS control and have used its control plugins before for position and velocity on previous occasions outside of Gazebo. My colleagues would want to use ROS as least as possible. Are there any options within Gazebo to allow me to achieve the same results?

2016-10-21 12:51:55 -0600 asked a question Made a 7 dof robot arm in Gazebo. Want the joints for the arm to act like electric motors and not free fall

Hello Gazebo Community,

I am a programmer that has come from ROS where I didn't have to rely on physics to simulate an arm moving, and I am having problems understanding how to prevent the arm from falling to the floor (from its rest state where the arm is pointing up).

I have some understanding of how to enable the model plugins to apply forces and torques to joints and bodies but i am not sure how i would apply the forces or torques to prevent the model from free falling.

in terms of what I have, I defined my 7 dof arm from scratch in a SDF, I defined the links(collision/visual/inertia), joints(pose/axis/NOT dynamics). I am using gazebo 7.3.1, and sdf ver 1.4. I have installed libgazebo7 to have access to the Gazebo libraries.

I am hoping this awesome community could enlighten me about a couple things:

  1. Is there a joint other than revolute that I should be using to properly control the robot arm. I looked into gearbox joint but not really sure if thats needed.
  2. Should I be using some sort of PID control plugin that controls the force that is being applied to the joints. BTW is there a way to apply torques to joints and not the bodies themselves using the Gazebo physics joints c++ library?
  3. Are there example programs/plugins that are available for me to look at that show how control a robot arm

Thanks Francis123.