Gazebo | Ignition | Community
Ask Your Question

winston's profile - activity

2021-02-10 17:38:46 -0600 received badge  Famous Question (source)
2019-08-19 12:19:42 -0600 marked best answer What is the topic ~/world_stats?

I am following this tutorial . It teaches me to write a program to listen on the topic ~/worldstats. I did and it worked. However, when I run $ gz topic -l, I cannot find a topic named ~/worldstats. So what is ~/world_stats? and what does the tilde '~' mean here? And what is 'ConstWorldStatisticsPtr'?

The following is the listener.cpp files for your reference:

#include <gazebo/transport/transport.hh>
#include <gazebo/msgs/msgs.hh>
#include <gazebo/gazebo.hh>

#include <iostream>

/////////////////////////////////////////////////
// Function is called everytime a message is received.
void cb(ConstWorldStatisticsPtr &_msg)
{
  // Dump the message contents to stdout.
  std::cout << _msg->DebugString();
}

/////////////////////////////////////////////////
int main(int _argc, char **_argv)
{
  // Load gazebo
  gazebo::setupClient(_argc, _argv);

  // Create our node for communication
  gazebo::transport::NodePtr node(new gazebo::transport::Node());
  node->Init();

  // Listen to Gazebo world_stats topic
  gazebo::transport::SubscriberPtr sub = node->Subscribe("~/world_stats", cb);

  // Busy wait loop...replace with your own code as needed.
  while (true)
    gazebo::common::Time::MSleep(10);

  // Make sure to shut everything down.
  gazebo::shutdown();
}
2019-06-20 03:26:40 -0600 commented question Custom models disappearing

Probably there is something wrong in your sdf file.

2019-06-19 10:59:16 -0600 received badge  Good Question (source)
2018-10-22 09:48:35 -0600 marked best answer How to replace event::ConnectionPtr with ros::Timer in gazebo model PLUGIN?

In example gazebo plugin codes, it seems to be a convention that people use event::Events::ConnectWorldUpdateBegin to let a portion of code running every simulation iteration. For example, I want to let World_Model::update method to run like this:

update_connection_ = event::Events::ConnectWorldUpdateBegin(boost::bind(&World_Model::update, this));

where update_connection is of type event::ConnectionPtr. But since I have 3 plugins in the model and it makes the simulaton work pretty slow, I don't want all the 3 plugins to run every simulation iteration. Instead, I think I can use ros::Timer as an alternative solution, so I modify the code above to this:

worldmodel_update_timer_ = nh->createTimer(ros::Duration(0.03),&World_Model::update,this);

where worldmodelupdatetimer is of type ros::Timer. Now the running of method World_Model::update does not depend on gazebo simulation update rate; now it should be handled by ros::Timer. I think it should work, but there comes the compilation error:

    In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
                 from /usr/include/boost/mem_fn.hpp:22,
                 from /usr/include/boost/bind/bind.hpp:26,
                 from /usr/include/boost/bind.hpp:22,
                 from /home/winston/workspace/nubot_gazebo_ws_extended/src/nubot/nubot_simulation/world_model/include/nubot/world_model/world_model.h:4,
                 from /home/winston/workspace/nubot_gazebo_ws_extended/src/nubot/nubot_simulation/world_model/src/world_model.cpp:5:
/usr/include/boost/bind/mem_fn_template.hpp: In instantiation of ‘R boost::_mfi::mf0<R, T>::call(U&, const void*) const [with U = const ros::TimerEvent; R = void; T = nubot::World_Model]’:
/usr/include/boost/bind/mem_fn_template.hpp:63:38:   required from ‘R boost::_mfi::mf0<R, T>::operator()(const U&) const [with U = ros::TimerEvent; R = void; T = nubot::World_Model]’
/usr/include/boost/function/function_template.hpp:225:11:   required from ‘static void boost::detail::function::function_void_mem_invoker1<MemberPtr, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with MemberPtr = void (nubot::World_Model::*)(); R = void; T0 = const ros::TimerEvent&]’
/usr/include/boost/function/function_template.hpp:934:38:   required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = void (nubot::World_Model::*)(); R = void; T0 = const ros::TimerEvent&]’
/usr/include/boost/function/function_template.hpp:722:7:   required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = void (nubot::World_Model::*)(); R = void; T0 = const ros::TimerEvent&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/usr/include/boost/function/function_template.hpp:1069:16:   required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = void (nubot::World_Model::*)(); R = void; T0 = const ros::TimerEvent&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/home/winston/workspace/nubot_gazebo_ws_extended/src/nubot/nubot_simulation/world_model/src/world_model.cpp:96:93:   required from here
/usr/include/boost/bind/mem_fn_template.hpp:40:43: error: no matching function for call to ‘get_pointer(const ros::TimerEvent&)’
         BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)();
                                           ^
/usr/include/boost/bind/mem_fn_template.hpp:40:43: note ...
(more)
2018-10-22 09:48:35 -0600 received badge  Self-Learner (source)
2018-01-04 10:04:57 -0600 received badge  Taxonomist
2017-11-21 01:08:24 -0600 received badge  Notable Question (source)
2017-11-21 01:08:24 -0600 received badge  Famous Question (source)
2017-08-19 05:11:45 -0600 received badge  Famous Question (source)
2017-07-10 20:29:02 -0600 edited answer Downloading models fails

You can download these models yourself from here. And then put these models in /usr/share/gazebo-[VERSION]/models. For e

2017-07-10 20:24:02 -0600 edited answer Downloading models fails

You can download these models yourself. And then put these models in /usr/share/gazebo-[VERSION]/models. For example, my

2017-07-10 20:23:04 -0600 edited answer Downloading models fails

You can download these models yourself. And then put these models in /usr/share/gazebo-[VERSION]/models. For example, my

2017-07-10 20:23:04 -0600 received badge  Associate Editor (source)
2017-07-10 20:22:32 -0600 answered a question Downloading models fails

You can download these models yourself. And then put these models in /usr/share/gazebo-[VERSION]/models. For example, my

2017-07-10 20:14:35 -0600 edited question Is it possible to do tensegrity structure simulation in Gazebo?

Hi! Is it possible to do tensegrity structure simulation in Gazebo? If so, please, give me some example to learn more ab

2017-07-10 20:13:58 -0600 edited question Is it possible to do tensegrity structure simulation in Gazebo?

Hi! Is it possible to do tensegrity structure simulation in Gazebo? If so, please, give me some example to learn more ab

2017-07-10 20:13:04 -0600 edited question Is it possible to do tensegrity structure simulation in Gazebo?

Hi! Is it possible to do tensegrity structure simulation in Gazebo? If so, please, give me some example to learn more ab

2017-07-06 15:21:23 -0600 marked best answer ‘setupClient’ is not a member of ‘gazebo’?

I followed the tutorial(animated box) here: Animated box. After I 'make' it in the build folder, I got the error in the file independent_listener.cc

 error: ‘setupClient’ is not a member of ‘gazebo’

What's the matter?

PS. I use gazebo 1.9 with ROS hydro on Ubuntu 12.04 LTS. The content of independent_listener.cc:

#include <gazebo/transport/transport.hh>
#include <gazebo/msgs/msgs.hh>
#include <gazebo/gazebo.hh>

#include <iostream>

/////////////////////////////////////////////////
// Function is called every time a message is received.
void posesStampedCallback(ConstPosesStampedPtr &posesStamped)
{
  std::cout << posesStamped->DebugString();

  ::google::protobuf::int32 sec = posesStamped->time().sec();
  ::google::protobuf::int32 nsec = posesStamped->time().nsec();
  std::cout << "Read time: sec: " << sec << " nsec: " << nsec << std::endl;

  for (int i =0; i < posesStamped->pose_size(); ++i)
  {
    const ::gazebo::msgs::Pose &pose = posesStamped->pose(i);
    std::string name = pose.name();
    if (name == std::string("box"))
    {
      const ::gazebo::msgs::Vector3d &position = pose.position();

      double x = position.x();
      double y = position.y();
      double z = position.z();

      std::cout << "Read position: x: " << x
          << " y: " << y << " z: " << z << std::endl;
    }
  }
}

/////////////////////////////////////////////////
int main(int _argc, char **_argv)
{
  // Load gazebo
  gazebo::setupClient(_argc, _argv);

  // Create our node for communication
  gazebo::transport::NodePtr node(new gazebo::transport::Node());
  node->Init();

  // Listen to Gazebo pose info topic
  gazebo::transport::SubscriberPtr sub =
  node->Subscribe("~/pose/info", posesStampedCallback);

  // Busy wait loop...replace with your own code as needed.
  while (true)
    gazebo::common::Time::MSleep(10);

  // Make sure to shut everything down.
  gazebo::shutdown();
}
2017-06-28 14:09:29 -0600 received badge  Enlightened (source)
2017-06-28 14:09:29 -0600 received badge  Good Answer (source)
2017-06-16 06:13:16 -0600 received badge  Famous Question (source)
2017-05-27 04:07:37 -0600 commented question Question about wind in Gazebo 8

Could you put your source code here so that we could understand more?

2017-05-22 06:16:50 -0600 received badge  Nice Answer (source)
2017-05-18 21:04:22 -0600 marked best answer Standard Units of Measure and Coordinate Conventions in Gazebo

I just wonder what are the standard units of measure in Gazebo? Is there anything like ROS REP 103 to standardize the units?

2017-05-06 19:12:42 -0600 edited answer remove gazebo2 and install gazebo7 for ros indigo

Yew, you have to remove gazebo2 first. Use this command: $ sudo apt-get remove gazebo2*. And then you follow the officia

2017-05-06 05:50:29 -0600 answered a question remove gazebo2 and install gazebo7 for ros indigo

Yew, you have to remove gazebo2 first. Use this command: $ sudo apt-get remove gazebo2*. And then you follow the officia

2017-04-27 02:07:24 -0600 edited question Gazebo Crashed when launch turtlebot world on ROS indigo and show the below message

Gazebo Crashed when launch turtlebot world on ROS indigo and show the below message [gazebo_gui-3] process has died [

2017-04-27 02:06:53 -0600 edited question Gazebo Crashed when launch turtlebot world on ROS indigo and show the below message

Gazebo Crashed when launch turtlebot world on ROS indigo and show the bellow message [gazebo_gui-3] process has died [pi

2017-04-27 02:04:55 -0600 commented answer A box stops moving suddenly

Why the gravity is set to (-1,0,-9.8) instead of (0,0,-9.8)?

2017-04-25 22:09:13 -0600 commented question Gazebo Crashed when launch turtlebot world on ROS indigo and show the below message

Try to kill the Gazebo process and restart it again. The error information just could not provide anything useful. Could

2017-04-23 23:50:11 -0600 answered a question Can more than one version of Gazebo be installed on the same system ?

Yes, you can. When you have installed several versions of Gazebo, you could find them out in /usr/share/gazebo,/usr/shar

2017-04-23 23:40:05 -0600 commented answer How to remove or respawn robots during the simulation?

I am not sure but I think .xacro should be OK. Why not have a try? BTW, if you have found the satisfied answer to your q

2017-04-23 23:39:48 -0600 commented answer How to remove or respawn robots during the simulation?

I am not sure but I think .xacro should be OK. Why not have a try? BTW, if you have fond the satisfied answer to your qu

2017-04-23 23:34:28 -0600 edited question failed to spawn a model by calling service

failed to spawn a model by calling service Hi everyone I try to spawn a hector quadrotor model in c++ file as a ros nod

2017-04-21 09:53:34 -0600 received badge  Nice Answer (source)
2017-04-21 09:07:29 -0600 answered a question How to remove or respawn robots during the simulation?

There are two methods in general: You could use a ROS service call as @iche033 has said. But you need to install gazeb

2017-04-21 08:50:50 -0600 answered a question What are the SDF Damping Units?

As it said, it is a coefficient. So it has NO units.

2017-04-21 08:43:41 -0600 answered a question Official PIONEER3-AT model falling trough the floor

You should add a ground_plane model and a sun model. See this file.

2017-04-21 08:31:12 -0600 answered a question JointController SetAngularVelocityTarget ?

You should try this functiongazebo::physics::Joint::SetVelocity as stated in link.

2017-04-19 21:09:53 -0600 answered a question Controlling an omnidirectional robot (like pr2) in ROS Hydro- Gazebo 1.9

You could check out this link. It is a Gazebo simulation for omnidirectional soccer-playing robots. Basically, I faked t

2017-04-19 21:06:58 -0600 answered a question Omnidirectional robot simulation

You could check out this link. It is a Gazebo simulation for omnidirectional soccer-playing robots. Basically, as Nate s

2017-03-10 04:11:05 -0600 received badge  Famous Question (source)
2017-01-13 06:14:33 -0600 received badge  Famous Question (source)
2017-01-13 06:14:33 -0600 received badge  Popular Question (source)
2017-01-13 06:14:33 -0600 received badge  Notable Question (source)