loading
 
Purpose of Vb script
Dario Mirkovski from Macedonia, Former Yugoslav Republic  [20 posts]
8 years
Hello, Im new in this field and need some help.

I am working with LEGO NXT, a robot which has to pick up a ball and place it on to a specific place.

The tutorial, it mentiones VBscript.
What is the purpose of the script? Beside finding the state, can also send commands in terms of how far is the robot and how much it should travel to pick up the object?

Thank you in advance.

Dario

Anonymous 8 years
Dario,

The VBScript module is mainly for quick scripting and changing of variables that are then used in other modules. The way the tutorial is written uses VB to change the values of the motor values which are then used in the Lego NXT module to send those values to the robot. So it is like a call to the Lego NXT but through the use of variables instead of a function call.

You can use this technique to do what you are asking for but you will have to modify the motor variables to cause the robot to change. Use the state technique to tell where in this procedure you are.

Note that you can also use other languages if you check out the API at

http://www.roborealm.com/help/API.php

which may be more comfortable for you. The same principal is in effect, where you would use an external application to change the variables that are still used by the Lego NXT module.

Note that the controlling of the Lego NXT is entirely vision based. So you don't have access to the encoders directly unless you write an NXT program and use the mailboxes to transfer where the ball is to the NXT which then your program on the NXT will have to decide what to do. Part of the problem here is that you have many possibilities. If you can write what you need onboad the NXT then I'd go with the mailbox approach (send the COG of the detected ball or location) and have the NXT deal with that information.

STeven.
Dario Mirkovski from Macedonia, Former Yugoslav Republic  [20 posts] 8 years
Hello,

First thank for your reply.

However, I have a camera attached on the PC and sending commands to the Lego via Bluetooth. I was wondering in the pipeline, the Vb module is at the end and executed last, so when it changes a state, does the pipeline goes again and do the if checks and act accordingly?

Another question, if something is changed in the situation for example the robot moved, can RoboRealm write the new variables every time a change happens?

Thank you in advance.

Dario
Nick Matheos  [17 posts] 8 years
Hello, like to jump in.

The pipeline is a loop, it runs over and over starting at the top, and I believe runs about as fast as the frames per second (fps).

I have done things similar to what you are trying and completely avoided using scripts altogether.  My way was sending the important info from roborealm to the lego nxt, such as the cog x and cog y values.  In this way I was able to use the lego nxt software to write my programs behavior, which happens to be easy for me.  I also want to note that the demo on roborealm will not work at all if the camera is not on the robot and entirely new program will need to be made.  I think this would include tracking the robot, which way it is facing and comparing this data with the tracking info on the ball.

Nicthegr

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

Thank you for the reply.

How do you mean that the demo will not fit? You refer to the Tutorials shown on the this web page?

You also mention that you have done similar project. I did some moving abilities and can move the lego through simple interface done in java. I plan to put a triangle on the robot and will try to reach the ball. However, I need an idea to solve the problem of telling the robot: Okey, the sharpest part of the triangle is towards the ball. Move forward untill you reach the ball. To sum up, the problem is to tell the robot to position itself to the right direction to the ball. I also need to get information all the time about its position.

Thank you in advance. Any information would be appreciated.

Dario
Nick Matheos  [17 posts] 8 years
Hello again,

If you have the camera directly overhead you should look at the path planning tutorial.  It sounds like something that could work for you.

nicthegr
magic wang from China  [2 posts] 8 years
hi, glad to see your thread!
i am doing the same job as you,
as Nicthegr said, i also want to send important imformation to NXT from roborealm, while the NXC program is running on the NXT waiting for the imformation to decide next motion.
How could you achieve this process to send imformation to NXT through bluetooth from roborealm?
Looking forward to your reply~
from magic
MSN: magic1986wang@hotmail.com
Anonymous 8 years
Couple items here:

1. Nicthegr is correct. The pipeline executes over and over again for each new frame grabbed so the main 'clock' of the system is the grabbing of a frame. As this is a vision system there is not much point in resending variables, etc, when now new frames are available. Thus the reason for the image grabbing being the timer. So RR can write changes each time something happens and a new image is grabbed to represent that change.

2. Dario, you can use the path_planning module in RR to achieve what you want (used in the tutorial Nicthegr mentions) or you can use a bit of trigonometry to achieve the same effect using the atan2 function. (Google atan2 to see how this is used). Basically you would get the angle of the robot to the destination and then the angle of the robot. With these two angles you can compare to see if they are the same (and if so move forward) or if not what direction should the robot turn to align itself with the robot<->destination angle. But I'd recommend using the path_planning module first as that is easier to grasp.

3. Magic - you should be able to use the message mailboxes in the NXT and the Variables in the RCX to communicate to the robot. Basically these allow RR variables to be assigned to them and then are transmitted over to the Lego Bot give a specific variable or mailbox number. In this way you can send over the vital bit of information from RR to the Lego system and have an application running on the Lego system interpret and react to that information. There is a lot of other posts that deal with this issue so use the forum search and see what others have had issues with.

STeven.
Anonymous 8 years
Hey,

Thank you for the reply.

However, when I load the Lego NXT module the Roborealm thing crashes. Even whenever i load for instance, a robo file which has many modules used into the pipeline again it crashes. However, i will have a look at the atan2 and at the path_planning thing. I want to make the project work utilizing RoboRealm as an image processing software and reading data from files previously saved.

Thank you for the time and the help.
Anonymous 8 years
Can you post a robofile that does crash when you load it? Or point us to one that does? That will help us to isolate what the problem could be and add a fix.

thanks,
STeven.
Anonymous 8 years
Hello,

Here is the script, which run and almost 50% crashes.

And another thing, at the last Geometrical Statistics module i can not get the angle of the ball although i am using the blob filter.

Thank you in advance.


program.robo
Anonymous 8 years
Ok, we found a small issue with the Blob Filter that might have caused the problem. Can you download v 2.1.0.2 that was just uploaded with a fix and let us know if that behaves any differently?

Thanks for the robofile!
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