how to calculate distance between objects
nithin  [2 posts]
16 year
well my problem is , there r 3 balls of diff colors which are to be put into there respective holes.......so is der any function in rr...........vch can find de distance b/w the bot n  balls and the ball n hole(respective) and the bot n holes.........

tried out using vb code but many errors occurin
so help me out m stuck up!!!

Anonymous 16 year

Is is very hard to understand your question when you try to use "IM" type language. Can you please use full sentences to describe your problem.

From what we can decipher, you would like to know the distance between the colored balls and ANY black hole? Is that correct?

The first step would be to collect information on all the objects in the scene. This can be done with a combination of RGB filter and blob filter. Have you been able to accomplish that task yet? Can you post your robofile of what you currently have?

From there we can tackle the VBScript that will perform the calculation (you will find the SQRT function to be useful in that regard). If you include the VBScript you have so far in the robofile then we can help you debug and complete that too.


simultaneous VBScript execution
rajiv  [1 posts]
16 year
hey steven,

we could calculate the distances and coordinates of the different balls(2 Red,2 Green,2 Yellow ones) with help of the different blob filters for each ball color followed by the watch variables for the cog respectively by VBScripts... now we want to collate the different programs finall giving us the distances and coordinates at the end with a single VBScript program.

(here we are able to do this by clicking on the 'reload and run' tab in the respective VBScripts and then clicking on the tab in the last VBScript to get the desired COG's and distances.)

but we want to get the COG's and distances in the final program without having to reload and run all the previous programs every time.

thanking you
Anonymous 16 year

To get this to work you will need to save the current variables and restore the image to the source image each time you process for another set of balls.

1. Use the Set_Statement to 'rename' the current COG_X to something different like RED_COG_X and so on. This module would be used at least twice to rename the COG to something that will not be overwritten by the COG module.

2. Once the rename is done use the 'Marker' module to restore the image to the source image. This will allow you to then reprocess the source image to look for another color.

After the Set_Statement and Marker module the next processing set can be implemented. You final VBScript would then use the GetVariable to access all sets of variables to pull everything together.

Include a robofile in two postings and we can help you through this process if you are still having difficultly.

that did work...but
16 year
Thankyou Steven Ji,

yes it did work by doing it in your way,the problamatic file is attached as "modified_ppics.robo"

New problem is,we need to initiate the waypoints as co-ordinates of ball as well as co-ordinates of the hole,so as to drop ball in hole.
so how would we initialize the COGs of the ball and hole in to array-waypoints without using a VBscripts,as we have to use another one at the end for the bot locomotion.
the file attached is "sainew.robo"

we would be very kind if you also give us a logic to put the second ball too,then of other colour.
Saikumar. from India  [20 posts] 16 year
oops! :P the pics and the file dint get attached...
hey and i was thinking of pipelining different files to put down each ball...
would that work?
One more oops,:D we 3 are from the same team.
pic and .robo file
Saikumar. from India  [20 posts]
16 year
pic and .robo,
A suggestion please include a "preview" option for replying.

the present problem
Saikumar. from India  [20 posts]
16 year
the robofile for the latest problem.
please excuse me if i have posted too
many times.
Anonymous 16 year

We had a quick look at your robofile and we're a little confused by what you are trying to accomplish. Is the point of this project is to determine which hole each of the balls should be placed into? What is the green triangle for?

So, if you ended up with a list of points as in

COG of ball, COG of nearest hole
100,200, 300, 340

etc. is that what you are looking for?


Anonymous 16 year
Here's a robofile with included image that shows how to calculate the distance from the non-black holes to the holes.

Note that we just use a couple (3) modules and mainly rely on the VBScript to do the final comparison. It is not the most efficient technique but since there are so few things to compare and we wanted to keep it simple it is sufficient.

The list that is produces is the balls COG coordinate -> holes COG coordinate. To id the ball/hole simply mouse over each of the balls/holes and check the X,Y coordinate in the status bar and compare with what's in the list.

Note we ignored the green triangle since this was not mentioned.

You should be able to take it from here ...


nithin  [2 posts] 16 year
hi steven
  The green triangle represents the bot and our goal is to put a particular colored ball into its respective hole..........and the holes are colored black.
waypoint array-pathplanning
Saikumar. from India  [20 posts]
16 year
Hi Steve,

How would you form an array of waypoints by assigning different variables to it?
I have seen doing with help of blobs->waypoints,with setvariable.

if I have x1,y1,x2,y2....how would I assign them to the waypoints array?

please use the second .robo file for this.
Hoping for a quick reply.
Anonymous 16 year

Turns out we can't do that just yet. We have a GetArrayVariable but we do NOT have a SetArrayVariable. We'll add that and release that update by tomorrow.

Saikumar. from India  [20 posts] 16 year
Hi STeven,

Thankyou verymuch.
We will be eagerly waiting for the reply :)

Warms Regards,
Anonymous 16 year
New version just uploaded. You can now use

ReDim point(4)

point(0) = 100
point(1) = 100
point(2) = 150
point(3) = 200

SetArrayVariable "waypoints", tmp

to create an array.


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