Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1.  
  2. #include <gazebo-2.0/gazebo/math/Pose.hh>
  3. #include <boost/bind.hpp>
  4. #include <gazebo/gazebo.hh>
  5. #include <gazebo/physics/physics.hh>
  6. #include <gazebo/common/common.hh>
  7. #include <gazebo/math/Matrix4.hh>
  8. #include <stdio.h>
  9. #include <cmath>
  10. #include <stdlib.h>
  11. #include <time.h>
  12. #include <iostream>
  13. #include <ostream>
  14. #include "gazebo/transport/transport.hh"
  15. #include "gazebo/msgs/msgs.hh"
  16. #include "gazebo/msgs/vector3d.pb.h"
  17. #include <gazebo/rendering/rendering.hh>
  18. #include <gazebo/gui/gui.hh>
  19. using namespace std;
  20. using namespace gazebo;
  21.  
  22. class SystemGUI : public SystemPlugin
  23. {
  24. public:~SystemGUI()
  25. {
  26. cout<<"in destructor"<<endl;
  27. }
  28.  
  29. public: void Load(int /*_argc*/, char ** /*_argv*/)
  30. {
  31. this->connections.push_back(event::Events::ConnectPreRender(boost::bind(&SystemGUI::Update, this)));
  32. cout<<"Load()"<<endl;
  33. }
  34. private: void Update()
  35. {
  36.  
  37. if (!this->userCam)
  38. {
  39. // Get a pointer to the active user camera
  40. this->userCam = gui::get_active_camera();
  41. cout<<userCam->GetName()<<endl;
  42. userCam->SetAspectRatio (3);
  43. }
  44.  
  45.  
  46. userCam->EnableViewController(TRUE);
  47. userCam->SetFocalPoint(math::Vector3(0,0,0.1));
  48. userCam->SetViewController("fps",math::Vector3(0,1,0.5));
  49.  
  50. scene = rendering::get_scene();
  51. if (!scene || !scene->GetInitialized())
  52. return;
  53. }
  54.  
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement