Calculating distance
Dario Mirkovski from Macedonia, Former Yugoslav Republic  [20 posts]
8 years

Was wondering what is the best module to be used in order to calculate the distance from the triangle to the ball.

Thank in advance.


Kevin from Ireland  [2 posts] 8 years
I would also appreciate this information
Anonymous 8 years
1. Enable the create blobs array in the blob_filter module. That will create a variable that contains all the COG's of all the remaining blobs in the image.
2. Use the Calculate_Distance module and select the first 4 blob array entries (which are assumed to be object1 and object2's cogs).
3. Display the results stored in my_distance

Note that you can also use the VBScript module to create the variable from the following euclidean distance formula.

blobs = getArrayVariable("BLOBS")

... check that blobs is an array and has at least 4 values and then

dx = blobs(0) - blobs(2)
dy = blobs(1) - blobs(3)
my_distance = sqrt((dx*dx)+(dy*dy))

which should get you the same results at the Calculate_Distance module.

See attached robofile.


Kevin from Ireland  [2 posts] 8 years
Excellent. thanks very much.

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