Gazebo | Ignition | Community
Ask Your Question

Haster's profile - activity

2016-12-18 16:48:43 -0600 received badge  Popular Question (source)
2016-12-18 14:38:19 -0600 received badge  Editor (source)
2016-12-18 04:10:20 -0600 asked a question Subscribing to new topic

I'm trying to subscribe box model to new topic to publish messages to. I have this Load functon

public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
{
  // Store the pointer to the model
  this->model = _parent;
  node = gazebo::transport::NodePtr(new gazebo::transport::Node());
  node->Init();
  sub = node->Subscribe("~/box", OnMsg);
}

And main is:

 int main(int _argc, char **_argv)
 {
    // Load gazebo
    // Create our node for communication
    gazebo::transport::NodePtr node(new gazebo::transport::Node());
    node->Init();
    // Publish to a Gazebo topic
    gazebo::transport::PublisherPtr pub =
            node->Advertise<gazebo::msgs::Pose>("~/box");
    // Wait for a subscriber to connect
    pub->WaitForConnection();
    std::cout << "Ok\n";
    // Publisher loop...replace with your own code.
    while (true)
    {
            // Throttle Publication
            gazebo::common::Time::MSleep(100);
            // Generate a pose
            ignition::math::Pose3d pose(1, 2, 3, 4, 5, 6);
            // Convert to a pose message
             gazebo::msgs::Pose msg;
             gazebo::msgs::Set(&msg, pose);
             pub->Publish(msg);
    }
    // Make sure to shut everything down.
    gazebo::client::shutdown();
 }

I'm not sure I'm doing it right, because new topic doesn't appear in topic list after start of gazebo. Is it possible to do something like that without ROS?

2016-12-16 01:46:00 -0600 received badge  Popular Question (source)
2016-12-14 13:21:05 -0600 asked a question How to get data from camera?

I want to make a simulation, where I get data from camera, send them to my application, then get an output (like velocities) and apply it to a model. As I understood from tutorials, it is a way to get data from Gazebo API through TCP/IP sockets. But is it posiible to get data from camera sensor by plugin, do some calculation and apply output to the model camera attached to?

I found an example of camera plugin, but I don't quite undestand how to use the data outside the camera. Or is it really necessary and I can do any calculation just inside OnNewFrame function and send data to the "parent"?