loading
 
ARRAY VARIABLE FOR PATH PLANNING
Dan Stevenson from United Kingdom  [12 posts]
9 years
Hi,

Roborealm automatically stores the x an y coordinate of each of the points on the path (shown in the pic) into an array called SAMPLE_LINE_POINTS. We just wanted to know the method behind using the individual points listed in the array. We tryed to create variable names for individual pairs of x and y coordinates (using set-variable). Is there a better method/ particular format that will allow us to make use of the numbers within the array?

Thanks

DAN and NICK
Anonymous 9 years
Dan,

In what way do you want to access the array? Note that the set variable will use the ':' to indicate an index. So SAMPLE_LINE_POINTS:2, SAMPLE_LINE_POINTS:3 would be the second x,y coordinate.

Note that accessing the points in VBScript is quite straightforward using the VBScript array. Or perhaps you are trying something different? Can you explain a little more what you are trying to do?

STeven.
Dan Stevenson from United Kingdom  [12 posts] 9 years
hi STeven,

Thanks for the advise it seems to be working ok, exept the array cannot store all the points once we use it in the path finding module. Also the field for the robot's position (which we put in COG_X and COG_Y) seems to just set the position at (0,0). I hope this is clear in the photo. I also put the screen shot so you can see that our values for COG_X and COG_Y are correct. What do you recommend?

Thanks

Dan and Nick

Anonymous 9 years
Dan,

The Path planning module as a limitation of 17 waypoints. This has to do more with the shortest path calculation being quite intensive. As you are not using that (from the screenshot) we will permit more waypoints to be used when that option is not set. Give us a couple days to release that update. Hopefully in the meantime you can test with fewer waypoints.

Try entering

[COGX_R] and [COGY_R]

into the text boxes instead of

COGX_R and COGY_R

i.e. add [] around the variables ... that tells RR that the stuff in the textbox is not a number but in fact a variable.

STeven.
Anonymous 9 years
One additional thought ... if you are wanting the robot to follow the white line try just using the "Plot along non-zero pixels" after you have segmented the image into a nice white line. In this case the line function as many waypoints that keep the robot on track. Specifying a start and stop point is all that is then required.

If you can post an original image without any of the overlaid graphics we can send you a robofile that will do that.

STeven.
Anonymous 9 years
Dan,

We made an update that provides another checkbox in the path planning interface to handle your situation better. If you check the < 256 point checkbox your waypoints are all nicely connected. See v 1.8.7.1 for this update.

STeven.
Dan Stevenson from United Kingdom  [12 posts] 9 years
Hi STeven,

This is what we have managed to do so far (without the update you mentioned), although i will definitly have a look at that. All three robots have the correct path planning points. The next stage is to actually get the robots to follow the points. We are starting with just the red robot as in the pic. We had a look at the example VBscript from the tutorials. This was quite useful except our robot seems to just go from side to side. We are struggling slightly with how to proceed. I have included the most recent VB script that we are using, just would appreciate any thoughts you might have. Thanks

Dan

------VBscript-------

forward = 188
backward = 68
stopped = 128

desiredOrientation = GetVariable("plan_orientation")

if desiredOrientation = "-1" then

  SetVariable "left_motor", stopped
  SetVariable "right_motor", stopped

else

robotOrientation = GetVariable("ANGLE_R")

robotOrientation = CInt((robotOrientation / 30) ) *30
desiredOrientation = CInt((desiredOrientation /30) ) * 30

diff = abs(desiredOrientation - robotOrientation )

if desiredOrientation = robotOrientation then

  SetVariable "left_motor", forward
  SetVariable "right_motor", forward

elseif desiredOrientation > robotOrientation and diff < 180 or _
  desiredOrientation < robotOrientation and diff >= 180 then

  SetVariable "left_motor", backward
  SetVariable "right_motor", forward

else

  SetVariable "left_motor", forward
  SetVariable "right_motor", backward

end if

end if





Anonymous 9 years
Dan,

The side to side movement most likely means that the timing is off a little. This oscillation is a common issue when dealing with a system of any latency. Basically what is happening is that the robot is getting the command to turn but by the time the system says stop the robot has turned too far and thus the system tries to compensate for that by turning it back. Once again the cycle repeats.

The way to reduce this is to do one/all of the following

1. slow the motor speeds or pulse the motors .. the pulsation forces a stop after some movement which will allow the system to catch  up
2. increase the communication speed to the robot or decrease the number of signals being set to it (i.e. only send data when it changes).
3. increase the processing rate of RR with camera. How many fps are you currently getting?

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index