Guest User

Untitled

a guest
Mar 17th, 2015
338
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <gazebo-2.0/gazebo/math/Pose.hh>
  2. #include <boost/bind.hpp>
  3. #include <gazebo/gazebo.hh>
  4. #include <gazebo/physics/physics.hh>
  5. #include <gazebo/common/common.hh>
  6. #include <gazebo/math/Matrix4.hh>
  7. #include <stdio.h>
  8. #include <cmath>
  9. #include <stdlib.h>
  10. #include <time.h>
  11. #include <iostream>
  12. #include <ostream>
  13. #include "gazebo/transport/transport.hh"
  14. #include "gazebo/msgs/msgs.hh"
  15. #include "gazebo/msgs/vector3d.pb.h"
  16. #include <gazebo/rendering/rendering.hh>
  17. #include <gazebo/gui/gui.hh>
  18.  
  19. using namespace std;
  20. using namespace gazebo;
  21.  
  22. class SystemGUI : public SystemPlugin
  23. {
  24.  
  25.  
  26. public: void Load(int /*_argc*/, char ** /*_argv*/)
  27. {
  28. cout<<"Load()!"<<sizeof(text)<<endl;
  29. this->connections.push_back(event::Events::ConnectPreRender(boost::bind(&SystemGUI::Update, this)));
  30. text.SetText("XXX");
  31. text.SetShowOnTop(true);
  32. text.SetColor(common::Color::Red);
  33. text.setDebugDisplayEnabled(true);
  34. text.SetCharHeight(100);
  35.  
  36. }
  37. private: void Update()
  38. {
  39.  
  40. if (!this->userCam)
  41. {
  42. this->userCam = gui::get_active_camera();
  43. userCam->SetAspectRatio (3);
  44. }
  45.  
  46.  
  47. scene = rendering::get_scene();
  48. if (!scene || !scene->GetInitialized())
  49. return;
  50.  
  51. }
  52.  
  53.  
  54. private : rendering::MovableText text;
  55. /// Pointer the user camera.
  56. private: rendering::UserCameraPtr userCam;
  57. rendering::ScenePtr scene;
  58. /// All the event connections.
  59. private: std::vector<event::ConnectionPtr> connections;
  60. };
  61.  
  62.  
  63. GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI);
RAW Paste Data