0
$\begingroup$

Rosanswers logo

Hi. I am using: RVIZ 1.13.1 melodic ubuntu 18.04

I have a task to visualize sensor data on a map. In the image below, it can be saw that the blue MarkerArray able to display correctly according to the path that the robot has moved. However, suddenly the MarkerArray failed to display on the left hand side and bottom right of the map. It seems like it is unable to publish anything if the coordinate provided is a negative value.

image description

Can anyone suggest me what should i do to solve this issue ?

Below is my coding in python to generate marker array.

        triplePoints = []
        colorsGroup = []
        markerArray = MarkerArray()
        for (x,y,z,a) in gdm_mean_data:
            if not numpy.isnan(a) and a > 0.10000000149 :
                p = Point() 
                p.x = x
                p.y = y
                p.z = -5
                marker = Marker()
                marker.header.frame_id = "/map"
                marker.type = marker.POINTS
                marker.action = marker.ADD
                marker.scale.x = 0.1
                marker.scale.y = 0.1
                marker.scale.z = 0.1
                colorsGroup.append(ColorRGBA(0,0,a,a))
                marker.pose.orientation.w = 1
                t = rospy.Duration()
                marker.lifetime = t
                triplePoints.append(p)
        marker.points = triplePoints
        marker.colors = colorsGroup
        markerArray.markers.append(marker)
        mean_marker.publish(markerArray)

Originally posted by KinWah on ROS Answers with karma: 91 on 2019-03-05

Post score: 0


Original comments

Comment by KinWah on 2019-03-05:
and is there anyway to change the map position (bottom left) to start with (0,0) ?

Comment by Delb on 2019-03-05:
I would test few things :

  1. If those values actually exist in gdm_mean_data
  2. Eventhough you find out that they exist, do they respect the if condition ?
  3. Check with rostopic echo /YOUR_MARKER_TOPIC if those values are published (if yes then there is something wrong with the marker)

Comment by KinWah on 2019-03-05:
Thanks @Delb! After review my own coding, it seems like it is my own algorithm problem xD Thanks for the hints !

Comment by Delb on 2019-03-05:
Can you answer your own question detailling what you did to make things work and mark it as correct please ? It can help future readers encoutering similar issues.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This issue is solved.

There are two methods to solve this issue.

The first method is I realized the coding i use to generate the coordinate for marker arrays only work for coordinate from 0 to 10 m only. By modifying this setting, it solved the problem. However, modifying this parameter affect the coding performance. Hence, I am try method 2.

The second method is to reposition the map coordinate by changing the Map's Position at the Display Panel at the left to 0;0. Currently I am looking for a way to achieve this method 2 since the mapping is done via rosbag ^_^


Originally posted by KinWah with karma: 91 on 2019-03-06

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Delb on 2019-03-06:
Thanks for adding your detailled answer. Now I'm not sure your second method is the best solution (it could be a work-around but not a viable option) because you just trick the map position but it can be overwritten.

Comment by Delb on 2019-03-06:
I think your first method is the right idea, a code should be able to deal with every coordinates so you can ask a new question providing your code and we might be able to find a more suitable solution for your issue :)

Comment by KinWah on 2019-03-07:
Thanks Delb for the advice ^_^ Currently I manage to solve the problem by using method 1. What you said is right as trick the map is not a good idea to be done. Will remember and practice it :)

$\endgroup$

Your Answer

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