ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

how to change color of name of frame in rviz as shown in figures?

asked 2019-05-28 00:48:36 -0500

Redhwan gravatar image

updated 2020-07-15 20:00:27 -0500

I need to change the color of names of frames from white to black, see figure 1, the background and name are white color while in figure 2 the background color is black and the name is white in rviz.

I need to alter between them

C:\fakepath\2.png

and

C:\fakepath\1.png

updated After @Orhan helped me, it works fine

you can see them with black color.

image description

please help me

thank you in advance

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-05-28 10:22:52 -0500

Orhan gravatar image

updated 2019-05-28 10:23:21 -0500

You may need to download the code and change this line, then build your own RViz: https://github.com/ros-visualization/rviz/blob/melodic-devel/src/rviz/default_plugin/tf_display.cpp#L570

frame->axes_->setToDefaultColors();
frame->name_text_->setColor(Ogre::ColourValue::White); // <--
frame->parent_arrow_->setHeadColor(ARROW_HEAD_COLOR);
frame->parent_arrow_->setShaftColor(ARROW_SHAFT_COLOR);

Line number can be different based on your ROS distro. You'll be needing the version of source code that was used to supply your distro's binaries.

edit flag offensive delete link more

Comments

Thank you, I will try to download it

Redhwan gravatar image Redhwan  ( 2019-05-28 19:42:35 -0500 )edit

I downloaded it for kinetic from here and put it on my /catkin_ws/src/ and used catkin_make, it built successfully....>[100%] Built target rviz_default_plugin but I don't know how to launch it. @Orhan, please help me. I used "rosrun rviz rviz" but it is the same befor.

Redhwan gravatar image Redhwan  ( 2020-07-15 03:21:07 -0500 )edit

Try entering roscd rviz command. If it brings you to /opt/ros/kinetic/share/rviz, then something is wrong with your terminal environment. Try re-sourcing your workspace after deleting build, devel, install folders and building back. e.g. source ~/catkin_ws/devel/setup.bash

Orhan gravatar image Orhan  ( 2020-07-15 13:41:28 -0500 )edit

I changed this line from

frame->name_text_->setColor(Ogre::ColourValue::White); to frame->name_text_->setColor(Ogre::ColourValue::Black); then used source ~/catkin_ws/devel/setup.bash

It works fine, thank you so much for your help @Orhan .

Note: all this modification is in the workstation part, not is in the robot part.

Redhwan gravatar image Redhwan  ( 2020-07-15 19:56:05 -0500 )edit

@Orhan what about color of arrows which joint two frames, you can see it yellow color, right?.

Can I change it to another color for example black or red?

Redhwan gravatar image Redhwan  ( 2020-07-15 20:41:56 -0500 )edit

I didn't check the source code or the rviz gui for that. But if you believe in yourself, you can find it in the source code in case there's no option in rviz.

Orhan gravatar image Orhan  ( 2020-07-15 21:21:27 -0500 )edit

@Orhan thanks

Redhwan gravatar image Redhwan  ( 2020-07-15 21:27:14 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-05-28 00:48:36 -0500

Seen: 1,089 times

Last updated: Jul 15 '20