Extract path positions out of visualization_msgs/Marker message

asked 2017-05-20 09:25:05 -0600

thepirate16 gravatar image

Hello guys,

I am using Rviz to display a path that my RRT planner is computing. The problem is that I want to extract the positions this path is going through. The type of message is visualization_msgs/Marker, which has the following fields:

uint8 ARROW=0
uint8 CUBE=1
uint8 SPHERE=2
uint8 CYLINDER=3
uint8 LINE_STRIP=4
uint8 LINE_LIST=5
uint8 CUBE_LIST=6
uint8 SPHERE_LIST=7
uint8 POINTS=8
uint8 TEXT_VIEW_FACING=9
uint8 MESH_RESOURCE=10
uint8 TRIANGLE_LIST=11
uint8 ADD=0
uint8 MODIFY=0
uint8 DELETE=2
uint8 DELETEALL=3
std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
string ns
int32 id
int32 type
int32 action
geometry_msgs/Pose pose
  geometry_msgs/Point position
    float64 x
    float64 y
    float64 z
  geometry_msgs/Quaternion orientation
    float64 x
    float64 y
    float64 z
    float64 w
geometry_msgs/Vector3 scale
  float64 x
  float64 y
  float64 z
std_msgs/ColorRGBA color
  float32 r
  float32 g
  float32 b
  float32 a
duration lifetime
bool frame_locked
geometry_msgs/Point[] points
  float64 x
  float64 y
  float64 z
std_msgs/ColorRGBA[] colors
  float32 r
  float32 g
  float32 b
  float32 a
string text
string mesh_resource
bool mesh_use_embedded_materials

I guess the path positions are inside the geometry_msgs/Point[] points field, but I am not finding the way to extract them using Python. Note that when I print the message its structure has values and strings combined, such this:

SOLUTION PATH ARRAY IS:[x: 11.3320412221
y: 14.1273676778
z: 0.3
 x: 3.65535733094
y: -1.1144215307
z: 0.3
 x: 11.3676537439
y: 12.7136135911
z: 0.3
 x: 3.65535733094
 ...

Does anyone know how to extract this location points? I would like to operate with them so I would like the value alone.

Thanks!

edit retag flag offensive close merge delete