ros melodic rviz visualization markers bug

asked 2019-10-30 10:18:53 -0600

Ochoa92 gravatar image

updated 2019-11-07 06:12:43 -0600

Hello ROS community,

I migrated from ROS kinetic to melodic recently and I found some bugs related to rviz visualization markers. For example, the points scale does not change and it is displayed always with a same color. I never have this kind of problem with kinetic and also with indigo. It is important to refer that I have tried already to reinstall ROS and also I copied the Markers: Points and Lines (C++) tutorial and the problem persist. In addition, this only happens with Points and Sphere Lists, because I tried with Line Strips and Line Lists and worked well.

The used algorithm is presented next:

#include <franka_udrilling/udrilling_state.h>
#include <tf/transform_broadcaster.h>
#include <visualization_msgs/Marker.h>

int main(int argc, char **argv){

    ros::init(argc, argv, "test_node");
    ros::NodeHandle nh;
    franka_udrilling::uDrillingState panda(nh);


    ros::Publisher marker_pub = nh.advertise<visualization_msgs::Marker>("visualization_marker", 10);

    visualization_msgs::Marker points, line_strip;
    points.header.frame_id = line_strip.header.frame_id = "/panda_link0";
    points.header.stamp = line_strip.header.stamp = ros::Time::now();
    points.ns = line_strip.ns = "points_and_lines";
    points.id = 0;
    line_strip.id = 1;
    points.action = line_strip.action = visualization_msgs::Marker::ADD;
    points.type = visualization_msgs::Marker::POINTS;
    line_strip.type = visualization_msgs::Marker::LINE_STRIP;

    points.pose.orientation.w = line_strip.pose.orientation.w = 1.0;

    // POINTS markers use x and y scale for width/height respectively
    points.scale.x = 0.01;
    points.scale.y = 0.01;

    // LINE_STRIP/LINE_LIST markers use only the x component of scale, for the line width
    line_strip.scale.x = 0.01;

    // Set the color -- be sure to set alpha to something non-zero!
    points.color.a = 1.0;
    points.color.r = 1.0f;
    points.color.g = 0.0f;
    points.color.b = 0.0f;

    // Line strip is blue
    line_strip.color.a = 1.0;
    line_strip.color.b = 1.0;

    // ---------------------------------------------------------------------------
    // GET INITIAL POSE
    // ---------------------------------------------------------------------------
    Eigen::Matrix4d O_T_EE;
    Eigen::VectorXd pose(7,1);


    // ---------------------------------------------------------------------------
    // MAIN LOOP
    // ---------------------------------------------------------------------------
    ros::Rate loop_rate(100);
    int count = 0;
    while (ros::ok()){

        O_T_EE = panda.O_T_EE;
        pose = panda.robotPose(O_T_EE);

        geometry_msgs::Point p;
        p.x = pose[0];
        p.y = pose[1];
        p.z = pose[2];

        points.points.push_back(p);
        line_strip.points.push_back(p);

        // if(line_strip.points.size() > 30){
        //   line_strip.points.erase(line_strip.points.begin());
        // }
        //
        // if(points.points.size() > 30){
        //   points.points.erase(points.points.begin());
        // }

        marker_pub.publish(points);
        // marker_pub.publish(line_strip);

        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space))
        break;

        ros::spinOnce();
        loop_rate.sleep();
        count++;
    }

    return 0;
}

Best Regards, Hélio Ochoa

As you can see in the pictures bellow the line markers works without any problems, but the point markers are completely invisible.

image description(/upfiles/15731284289094426.png)image description

edit retag flag offensive close merge delete

Comments

1

There is a good chance this is not a "bug" in the markers, but ros/urdfdom_headers#41, which is a known issue on Bionic+Melodic installs when using non US.UTF-8 locale settings (or any locale that uses a , instead of a . for numbers with decimals).

Please see #q272692 for an older Q&A about this.

gvdhoorn gravatar imagegvdhoorn ( 2019-10-31 09:14:36 -0600 )edit

Please attach your screenshot directly to the question. I've given you sufficient karma for that.

gvdhoorn gravatar imagegvdhoorn ( 2019-10-31 09:15:30 -0600 )edit

Thank you for your help. I tried what you suggest, but unfortunately in my case did not work. Do you have any other solution?

Ochoa92 gravatar imageOchoa92 ( 2019-11-04 05:35:04 -0600 )edit

As always: "does not work" is not a sufficient description of any problem.

Can you describe what exactly you've tried? Be very specific, it's crucial to understand which commands, in which terminals and in what order you've used.

It could well be that your problem is actually not linked to the locale issue, but for now I cannot conclude that.

gvdhoorn gravatar imagegvdhoorn ( 2019-11-04 06:05:10 -0600 )edit

@Ochoa92: can you process my earlier comment here? Thanks.

gvdhoorn gravatar imagegvdhoorn ( 2019-11-04 06:05:56 -0600 )edit

Sorry. Basically I put the following line in my ".bashrc" file and then I restart the terminal: export LC_NUMERIC="en_US.UTF-8"

Ochoa92 gravatar imageOchoa92 ( 2019-11-04 09:17:40 -0600 )edit

As you can see in the screenshots the points have no color and a very small scale.

Ochoa92 gravatar imageOchoa92 ( 2019-11-07 06:14:46 -0600 )edit