Gazebo | Ignition | Community
Ask Your Question
0

how to use "MovableText"?

asked 2015-03-17 03:36:36 -0500

Zheng yo chen gravatar image

I found this class on api documentaion(http://osrf-distributions.s3.amazonaws.com/gazebo/api/1.2.5/classgazebo11rendering11MovableText.html)

Its description said "description: This create create a billboarding object that display a text." (https://bitbucket.org/osrf/gazebo/src/e8f7b58b28a8fc88dfd3480c7a6ea76e7c7032a9/gazebo/rendering/MovableText.cc?at=gazebo-current-prerelease_2.2.0)

So , I imaged that my gazebo window would be like this (http://imgur.com/inihTnQ).

Because this class is under the namespace"rendering",

I thought "MovableText" should be used in system plugin

Then, i built a system plugin like this (http://pastebin.com/mTtTVR8s)

But ,nothing happened!

could you tell me how to use this class correctly,thank you~

edit retag flag offensive close merge delete

Comments

Looking into the API, maybe you should call the Load function as well at first.

AndreiHaidu gravatar imageAndreiHaidu ( 2015-03-17 05:07:04 -0500 )edit

hi,thank you for your advise, but after adding "text.load("AA","BB","Monospace",10)", still nothing happened

Zheng yo chen gravatar imageZheng yo chen ( 2015-03-18 01:29:36 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-03-24 00:59:09 -0500

Zheng yo chen gravatar image

I found MovableText on ogre website(http://www.ogre3d.org/tikiwiki/MovableText)

and It does work !

That's what I need!

http://i.imgur.com/MTH7i0d.png

edit flag offensive delete link more
2

answered 2015-03-17 12:23:40 -0500

chapulina gravatar image

updated 2015-03-20 02:00:40 -0500

You can see an example of MovableText being used here.

Since rendering::MovableText inherits from Ogre::MovableObject, you need to attach it to the Ogre::SceneNode of a Gazebo rendering::Visual. Something like this for example:

// Get the user camera
rendering::UserCameraPtr userCamera = gui::get_active_camera();

// Create a visual and add it to the camera's scene
rendering::VisualPtr visual;
visual->Load();
userCamera->GetScene()->AddVisual(visual);

// Create text, Obs: Font size is in meters
rendering::MovableText *text;
text->Load("__TEXT_OBJECT__", "text displayed", "Arial", 0.1);

// Create a node for the text
Ogre::SceneNode *textNode = visual->GetSceneNode()->createChildSceneNode("__TEXT_NODE__");
textNode->attachObject(text);
edit flag offensive delete link more

Comments

hi ,there, thank you for your advice .I revised my code (http://pastebin.com/7egMy7fJ).But It still can not show the text :( , thank you

Zheng yo chen gravatar imageZheng yo chen ( 2015-03-19 22:04:01 -0500 )edit

I updated the answer with an example, I haven't tested it though. Note that the font size is in meters, you're using 200 in your code, so maybe if you zoom out a lot you can see the text.

chapulina gravatar imagechapulina ( 2015-03-20 02:03:22 -0500 )edit

thank you , but I have runtime error.. :(

Zheng yo chen gravatar imageZheng yo chen ( 2015-03-24 00:50:29 -0500 )edit

Hi, could you share the sample code by GitHub? The link has died :(((

neet gravatar imageneet ( 2021-07-05 05:59:38 -0500 )edit

Question Tools

Stats

Asked: 2015-03-17 03:36:36 -0500

Seen: 1,760 times

Last updated: Mar 24 '15