# Cannot create robot with polygons in stage

Hi, I am trying to create a robot model with polygons in stage world file. I tried to use the description from: How to Use Player/Stage Here it is:

define robot model

(

polygons 1

polygon[0].points 6

polygon[0].point[0] [0 0]

polygon[0].point[1] [0 1]

polygon[0].point[2] [0.75 1]

polygon[0].point[3] [1 0.75]

polygon[0].point[4] [1 0.25]

polygon[0].point[5] [0.75 0]

)

The robot should have 6 corners, and look like a 1 m square with two angles cut. But the result is quite different - it is just a simple square which side is much smaller than a meter (0.4 m approximately). The same appears when I do not set any size parameters at all. I use stage 4.1.1 with ROS Indigo on Ubuntu 14.04, if this information can help. Please, help me to find a solution!

edit retag close merge delete

Sort by » oldest newest most voted

Ok. I found the solution. At first, if the robot have a complex shape, it should be defined by several polygons (that was said in the manual). Second, the syntax changed and now you do not need to write "polygon", so the structure is:

Block

 ( points .. #amount of points starts with 1, not zero point[0] [.. ..] #point coordinates: x, y point [1] [.. ..] z [0 1] ) size [.. .. ..] # size of the robot in your simulation

I got correct results, if the coordinates of the points did not exceed 1.00. The coordinates of the points are not size in meters, which you set by the "size" string. Size of the robot should be proportional to the robot shape size, which you set up with points coordinates. Each "polygon" of the robot must be defined as a new block. You can also set different colours for blocks. And unfortunately I have no idea what "z [0 1]" is for. I hope that my experience will be useful for somebody.

more