Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2012-2014 Open Source Robotics Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
- #include <gazebo/gazebo.hh>
- #include <gazebo/transport/transport.hh>
- #include <gazebo/msgs/msgs.hh>
- #include <gazebo/math/gzmath.hh>
- #include <iostream>
- /////////////////////////////////////////////////
- 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();
- gazebo::transport::PublisherPtr modelPub = node->Advertise<gazebo::msgs::Model>("~/model/modify");
- // Wait for a subscriber to connect
- modelPub->WaitForConnection();
- // Publisher loop...replace with your own code.
- while (true)
- {
- // Throttle Publication
- gazebo::common::Time::MSleep(1000);
- // Generate a pose
- gazebo::math::Pose pose(10, 10, 0, 0, 0, 0);
- gazebo::msgs::Model msg;
- msg.set_name("box"); // name of the model as defined in the .world file
- gazebo::msgs::Set(msg.mutable_pose(), pose);
- modelPub->Publish(msg);
- }
- // Make sure to shut everything down.
- gazebo::shutdown();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement