Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use UserCamera->ViewController()?

I am running gazebo2.2.

I want to control UserCam ,and looked up in API doc(http://osrf-distributions.s3.amazonaws.com/gazebo/api/2.2.1/classgazebo_1_1rendering_1_1UserCamera.html#a7148635d156d63c3e163bf1c28bb547e)

I found three function as following:

EnableViewController(TRUE); SetFocalPoint(math::Vector3(0,0,0.1)); SetViewController("orbit",math::Vector3(0,1,0.5));

So , I imaged that my userCam would orbit the point(0,0,0.1)

but, It turned out nothing happened!

Did I miss some steps?

Thank you~!

if it is possible, can you check my code?

Here is my code:

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="">

#include <signal.h>

using namespace std; using namespace gazebo;

class SystemGUI : public SystemPlugin { public:~SystemGUI() { cout<<"in destructor"<<endl; }<="" p="">

public: void Load(int /_argc/, char * /_argv*/) { this->connections.push_back(event::Events::ConnectPreRender(boost::bind(&SystemGUI::Update, this))); cout<<"Load()"<<endl; }="" private:="" void="" update()="" {<="" p="">

if (!this->userCam)
{
    // Get a pointer to the active user camera
    this->userCam = gui::get_active_camera();
    cout<<userCam->GetName()<<endl;
    userCam->SetAspectRatio (3);
}

math::Vector3(0, pitch, yaw)));

userCam->EnableViewController(TRUE);
userCam->SetFocalPoint(math::Vector3(0,0,0.1));
userCam->SetViewController("fps",math::Vector3(0,1,0.5));

scene = rendering::get_scene();
if (!scene || !scene->GetInitialized())
return;

}

/// Pointer the user camera. private: rendering::UserCameraPtr userCam; rendering::ScenePtr scene; /// All the event connections. private: std::vector<event::connectionptr> connections;

};

GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI);

How to use UserCamera->ViewController()?

I am running gazebo2.2.

I want to control UserCam ,and looked up in API doc(http://osrf-distributions.s3.amazonaws.com/gazebo/api/2.2.1/classgazebo_1_1rendering_1_1UserCamera.html#a7148635d156d63c3e163bf1c28bb547e)

I found three function as following:

EnableViewController(TRUE); SetFocalPoint(math::Vector3(0,0,0.1)); SetViewController("orbit",math::Vector3(0,1,0.5));

So , I imaged that my userCam would orbit the point(0,0,0.1)

but, It turned out nothing happened!

Did I miss some steps?

Thank you~!

if it is possible, can you check my code?

Here is my code:

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="">

#include <signal.h>

using namespace std; using namespace gazebo;

class SystemGUI : public SystemPlugin { public:~SystemGUI() { cout<<"in destructor"<<endl; }<="" p="">

public: void Load(int /_argc/, char * /_argv*/) { this->connections.push_back(event::Events::ConnectPreRender(boost::bind(&SystemGUI::Update, this))); cout<<"Load()"<<endl; }="" private:="" void="" update()="" {<="" p="">

if (!this->userCam)
{
    // Get a pointer to the active user camera
    this->userCam = gui::get_active_camera();
    cout<<userCam->GetName()<<endl;
    userCam->SetAspectRatio (3);
}

math::Vector3(0, pitch, yaw)));

userCam->EnableViewController(TRUE);
userCam->SetFocalPoint(math::Vector3(0,0,0.1));
userCam->SetViewController("fps",math::Vector3(0,1,0.5));

scene = rendering::get_scene();
if (!scene || !scene->GetInitialized())
return;

}

/// Pointer the user camera. private: rendering::UserCameraPtr userCam; rendering::ScenePtr scene; /// All the event connections. private: std::vector<event::connectionptr> connections;

};

GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI);

How to use UserCamera->ViewController()?

I am running gazebo2.2.

I want to control UserCam ,and looked up in API doc(http://osrf-distributions.s3.amazonaws.com/gazebo/api/2.2.1/classgazebo_1_1rendering_1_1UserCamera.html#a7148635d156d63c3e163bf1c28bb547e)

I found three function as following:

EnableViewController(TRUE); SetFocalPoint(math::Vector3(0,0,0.1)); SetViewController("orbit",math::Vector3(0,1,0.5));

So , I imaged that my userCam would orbit the point(0,0,0.1)

but, It turned out nothing happened!

Did I miss some steps?

Thank you~!

if it is possible, can you check my code?

Here is my code:

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:~SystemGUI() { cout<<"in destructor"<<endl; }<="" p="">

public: void Load(int /_argc/, char * /_argv*/) { this->connections.push_back(event::Events::ConnectPreRender(boost::bind(&SystemGUI::Update, this))); cout<<"Load()"<<endl; }="" private:="" void="" update()="" {<="" p="">

if (!this->userCam)
{
    // Get a pointer to the active user camera
    this->userCam = gui::get_active_camera();
    cout<<userCam->GetName()<<endl;
    userCam->SetAspectRatio (3);
}

math::Vector3(0, pitch, yaw)));

userCam->EnableViewController(TRUE);
userCam->SetFocalPoint(math::Vector3(0,0,0.1));
userCam->SetViewController("fps",math::Vector3(0,1,0.5));

scene = rendering::get_scene();
if (!scene || !scene->GetInitialized())
return;

}

/// Pointer the user camera. private: rendering::UserCameraPtr userCam; rendering::ScenePtr scene; /// All the event connections. private: std::vector<event::connectionptr> connections;

};

GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI);

How to use UserCamera->ViewController()?

I am running gazebo2.2.

I want to control UserCam ,and looked up in API doc(http://osrf-distributions.s3.amazonaws.com/gazebo/api/2.2.1/classgazebo_1_1rendering_1_1UserCamera.html#a7148635d156d63c3e163bf1c28bb547e)

I found three function as following:

EnableViewController(TRUE); SetFocalPoint(math::Vector3(0,0,0.1)); SetViewController("orbit",math::Vector3(0,1,0.5));

So , I imaged that my userCam would orbit the point(0,0,0.1)

but, It turned out nothing happened!

Did I miss some steps?

Thank you~!

if it is possible, can you check my code?

Here is my code:

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:~SystemGUI() { cout<<"in destructor"<<endl; }<="" p="">

public: void Load(int /_argc/, char * /_argv*/) { this->connections.push_back(event::Events::ConnectPreRender(boost::bind(&SystemGUI::Update, this))); cout<<"Load()"<<endl; }="" private:="" void="" update()="" {<="" p="">

if (!this->userCam)
{
    // Get a pointer to the active user camera
    this->userCam = gui::get_active_camera();
    cout<<userCam->GetName()<<endl;
    userCam->SetAspectRatio (3);
}

math::Vector3(0, pitch, yaw)));

userCam->EnableViewController(TRUE);
userCam->SetFocalPoint(math::Vector3(0,0,0.1));
userCam->SetViewController("fps",math::Vector3(0,1,0.5));

scene = rendering::get_scene();
if (!scene || !scene->GetInitialized())
return;

}

/// Pointer the user camera. private: rendering::UserCameraPtr userCam; rendering::ScenePtr scene; /// All the event connections. private: std::vector<event::connectionptr> connections;

};

GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI);code: http://pastebin.com/QvniRiKK

How to use UserCamera->ViewController()?

I am running gazebo2.2.

I want to control UserCam ,and looked up in API doc(http://osrf-distributions.s3.amazonaws.com/gazebo/api/2.2.1/classgazebo_1_1rendering_1_1UserCamera.html#a7148635d156d63c3e163bf1c28bb547e)

I found three function as following:

EnableViewController(TRUE); SetFocalPoint(math::Vector3(0,0,0.1)); SetViewController("orbit",math::Vector3(0,1,0.5));

So , I imaged that my userCam would orbit the point(0,0,0.1)

but, It turned out nothing happened!

Did I miss some steps?

Thank you~!

if it is possible, can you check my code?

Here is my code: http://pastebin.com/QvniRiKKhttp://pastebin.com/emWnSf00