0
$\begingroup$

Gazebo Answers logo

I found this class on api documentaion(http://osrf-distributions.s3.amazonaws.com/gazebo/api/1.2.5/classgazebo_1_1rendering_1_1MovableText.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~


Originally posted by Zheng yo chen on Gazebo Answers with karma: 80 on 2015-03-17

Post score: 0


Original comments

Comment by AndreiHaidu on 2015-03-17:
Looking into the API, maybe you should call the Load function as well at first.

Comment by Zheng yo chen on 2015-03-18:
hi,thank you for your advise, but after adding "text.load("AA","BB","Monospace",10)", still nothing happened

$\endgroup$

2 Answers 2

0
$\begingroup$

Gazebo Answers logo

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);

Originally posted by chapulina with karma: 7504 on 2015-03-17

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by Zheng yo chen on 2015-03-19:
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

Comment by chapulina on 2015-03-20:
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.

Comment by Zheng yo chen on 2015-03-24:
thank you , but I have runtime error.. :(

Comment by neet on 2021-07-05:
Hi, could you share the sample code by GitHub? The link has died :(((

$\endgroup$
0
$\begingroup$

Gazebo Answers logo

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


Originally posted by Zheng yo chen with karma: 80 on 2015-03-24

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.