Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gazebo-2.0/gazebo/math/Pose.hh>
- #include <boost/bind.hpp>
- #include <gazebo/gazebo.hh>
- #include <gazebo/physics/physics.hh>
- #include <gazebo/common/common.hh>
- #include <gazebo/math/Matrix4.hh>
- #include <stdio.h>
- #include <cmath>
- #include <stdlib.h>
- #include <time.h>
- #include <iostream>
- #include <ostream>
- #include "gazebo/transport/transport.hh"
- #include "gazebo/msgs/msgs.hh"
- #include "gazebo/msgs/vector3d.pb.h"
- #include <gazebo/rendering/rendering.hh>
- #include <gazebo/gui/gui.hh>
- using namespace std;
- using namespace gazebo;
- class SystemGUI : public SystemPlugin
- {
- public: void Load(int /*_argc*/, char ** /*_argv*/)
- {
- cout<<"Load()!"<<endl;
- this->connections.push_back(event::Events::ConnectPreRender(boost::bind(&SystemGUI::Update, this)));
- }
- public:void Init()
- {
- cout<<"Init()!"<<endl;
- //get_scene() 不能放在Load()
- scene = rendering::get_scene();
- text=new rendering::MovableText();
- }
- private: void Update()
- {
- if (!this->userCam)
- {
- cout<<"enter one time"<<endl;
- this->userCam = gui::get_active_camera();
- userCam->SetAspectRatio (3);
- text->Load("_TEXT__","0N", "Arial", 200);
- text->SetShowOnTop(true);
- TextNode =world_visual->GetRootVisual()->GetSceneNode()->createChildSceneNode("_TEXT_NODE_");
- TextNode->attachObject(text);
- }
- scene->DrawLine(math::Vector3(0,0,0),math::Vector3(10,10,10),"XX");
- if (!scene || !scene->GetInitialized())
- return;
- }
- /// Pointer the user camera.
- private: rendering::UserCameraPtr userCam;
- rendering::MovableText *text;
- Ogre::SceneNode *TextNode ;
- rendering::VisualPtr world_visual;
- rendering::ScenePtr scene;
- /// All the event connections.
- private: std::vector<event::ConnectionPtr> connections;
- };
- GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement