Hi Guys,
I am running this bs2 code on my Boe Bot and vb script in roborealm. And I am not sure how to use the serial command window on roborealm. I can connect to my eb500 bluetooth with roborealm, but I am not sure how to set up the serial part of roborealm. The variables are being sent but Boe Bot just jerks around in circles. can anyone help?
Thanks
Tom

' get the size (width or height) of the current
' bounding box
size = GetVariable("COG_BOX_SIZE")

' if it is equal to "" then no object was detected
if size <> "" then

' get the horizontal center of gravity found by the COG
' module
cogX = GetVariable("COG_X")
' if it is less than 75 the blob is on the left side
' of the screen so move that way
if cogX < 75 then
left_base = 750-(80-cogX)/2
right_base = 750
' otherwise move to the right if above 85 pixels (and no
' movement if 75 < cogX < 85 )
elseif cogX > 85 then
left_base = 750
right_base = 750-(cogX-80)/2
end if

' if the ball is too close then we have to move backwards
if (size>40) then
left_motor = left_base+((size-40)*2)
right_motor = right_base+((size-40)*2)
' otherwise move forward
else
left_motor = left_base-((40-size)*2)
right_motor = right_base-((40-size)*2)
end if

' set the final motor values to be picked up by
' the SSC module
SetVariable "LEFT_MOTOR", left_motor
SetVariable "RIGHT_MOTOR", right_motor

' now lets work on the tilt ... grab the current
' tilt value
tilt = GetVariable("TILT")
' if it was not set then default to 220 (in our case
' this is horizontal to the floor)
if tilt = "" then
tilt = 220
end if

' if the blob is below 55 then tilt down up a bit more
' otherwise tilt up a little more
cogY = GetVariable("COG_Y")
if cogY < 55 then
tilt = tilt - (60-cogY)/5
elseif cogY > 65 then
tilt = tilt + (cogY-60)/5
end if

' we don't want to look up more than horizontal to the
' floor as we don't expect the
' ball to be on the ceiling
if tilt > 220 then
tilt = 220
end if

' and set that value for the SSC module too
SetVariable "TILT", tilt

end if

I am only sending the motor variables

Anonymous

12 years

Tom,

Try what the Parallax forums have mentioned (making the motor values 16 bits) and see if that makes a difference. Note that I assume you are using something like

(single backslash)[left_motor](single backslash)[right_motor]

correct? When you switch your PBasic program to accept 16 bits you will need to change the above to double backslashes since a single backslash will only transmit 8 bits over serial whereas a double will do 16. Or you can keep that the same but do the cast of 8 to 16 bits in the stamp before sending them to the PULSOUT motor coordinates.

STeven.

Anonymous

12 years

When I add the slashes it does not work at all. sorry about the other posts related to this one. I press wrong button to reply.

Boe Bot Serial Communication Anonymous

12 years

Tom,

Are you using the most current version of RoboRealm? The double slash technique was added about two weeks ago or so. Let us know if you still have an issue and we will investigate further.

STeven.

Anonymous

12 years

Hi STeven,
I am using roborealm I downloaded yesterday. I am still having problem. When I add the slashes Boe Bot will not respond at all. Without slashes Boe bot will sporadically turn left only and it will not back up at all. I do not know about the cast thing you mentioned earlier, can you give me alittle more info on that.
Thanks
Tom
P.S. Is the Boe Bot plug in almost ready? I am going nuts here.....lol

Anonymous

12 years

STeven,
Can you tell me exactly what the form of data is when it goes through serial port from roborealm? I am sending 2 variables and I also need to know how they start and end if I am to have any hope of making this work correctly. Forgive my ignorance on this subject, but I am trying to learn as I go.
Thanks
Tom

Anonymous

12 years

Hi Again Steven,
I have discovered a problem with my eb500 bluetooth device. I am sure that is why I have not been able to use the serial setup in Roborealm. I will get a new one and let you know what happens.
Tom

Anonymous

12 years

Tom,

We tries the code you supplied with the Boe-Bot and found that there are some modifications that need to be made. Below is the robo-file that you can use to test the connection (try using the serial cord connection instead of the bluetooth for now). Note that the serial module has a cr at the end of the left and right motor variables. This cr is used to check in the boe-bot that everything was transmitted correcting. Using the robo-file and the following boe-bot program we were able to get the boe bot to turn based on the position of a red object. Give it a try and see if it improves what you currently have.

Let us know how it goes. We are working on a boe-bot module that will be ready in a week or two but you should be able to use the serial module to get started.

Hi STeven,
Thanks so much for taking the time to do this. When I tried to load the Bs2 code my basic stamp editor would not let me load the second backslash in the following line :
SERIN 16, 84, 20, xmitFailed, [STR rcv_data\\9]
The error stated expected a constant, variable, unary operator, or '(' with the second backslash highlighted.
I am using Basic Stamp Editor 2.2 with pbasic 2.5

Thanks
Tom

Anonymous

12 years

I do not know why the last post got 4 slashes there should only be 2.
slashslash9

Anonymous

12 years

Tom,

there is a problem with the forum posting code ... it doubles up the backslash on any posted code. Just translate each double one to a single backslash. We'll see about fixing that problem.

STeven.

Anonymous

12 years

Hi STeven,
Thank You for the work you have done so far. I have not been able to get the code to work yet. My eb500 connects ok when robo program starts, but the servos do not respond to movement of red object. I can see the variables changing but it has no effect on Boe Bot. A similar thing happened with MSRS. When I switched from MSRS version 1.0 to version 1.5 and tried the tutorials that had worked with 1.0 my eb500 would connect but servos would not respond. When I switched back to version 1.0 everything worked fine. I dont know if this helps at all, but I figured I would mention it since the behavior is very similar.
Thanks Again
Tom

Anonymous

12 years

Tom,

Check your motor pins. The code we posted was using pin 15 and 14 which are not the ones the BoeBot manual says to use.

If the pins check out but a freqout after the serial command to hear if the serial command is completing correctly. If not, check that the serial module has the <cr> at the end.

Also note that the \9 at the end of the read serial command was in fact just one backslash as apposed to the doubling error that the forum caused (which is now hopefully fixed).

If all that does not work then hard code some values that increment to even see if you can move the servo's at all.

STeven.

Anonymous

12 years

Hi Steven,
I have double checked servo connections. I can tell you that when I turn the Boe Bot on it slowly turns in place. When I start roborealm the green light on the eb500 lights up. Roborealm opens and I can wave a red object in front of cam and roborealm responds the way it should, but the Boe Bot continues to slowly turn around in place as it does before I start roborealm. I suspect that maybe my dongle may be incompatible. I am using a kensington bluetooth usb adapter 2.0 What kind are you using?
Tom

Anonymous

12 years

Tom,

quick thought .. your script was using pin 0 for serin ... we were using pin 16 which is used when you have a direct serial cable connected to the BOE. Either try with a serial cable or switch the serin number to 0 like you had it.

We only tried with the serial cable and did not try this with BT just yet.

STeven.

Anonymous

12 years

Thanks STeven, I will give that a try today.
Tom

Anonymous

12 years

Hi Steven,
I am still unable to get any predictable results. One thing that I am noticeing is that something seems to be loading up. I have tried with and without the serial cable and I have had similar behaviors for both. I get no response to variable changes unless I bring object very close to cam, when I do the servos will speed up and stay in the same state even after I take the object away. The only way to change the state of the servos after this happens is to reset the boe bot. This happens with the eb500 removed from BOE as well. So I'm thinking it may be related to the memory use on the bs2. I am not experienced enough to remedy this problem, but I hope this information helps in the debugging.
Thanks
Tom

Anonymous

12 years

Tom,

Can you try the other programs that come with the BoeBot to see if they still function as expected? At this point you may just want to verify that your BoeBot is functioning normally. Are you able to run the servos at different speeds even when you code those values directly into a PBasic program? I.e. use a for loop that slowly increases and decreases the motor values.

STeven.

Anonymous

12 years

Hi Steven,
My boe bot works fine with other code. As a matter of fact this code works to test eb500 and 1 servo. I am using the program.robo that you posted and this short bs2 code works with it to test communication and servo function. This code also works with direct serial connection when you change serin pin to 16

x VAR Word
main:
SERIN 0,84,[DEC x]
PULSOUT 15,x
PAUSE 5
GOTO main

Thanks
Tom

Anonymous

12 years

Note that this code will not work with the robo-file that we posted. The issue is with the use of "DEC" in the serin. That looks for an ascii string that represents a number. The posted robo-file transmits a 4 byte number ... not an ascii string. You will have to change the serial module to output

[cog_x]<cr>

i.e. remove the double \\ in front of the variable. You also need the <cr> since the "DEC" in pbasic looks for the first non-digit ascii code in order to know that the number is complete.

Try that change with the above code that you posted and see if you have better success.

STeven.

Anonymous

12 years

Hi Steven,
Now I'm getting confused...lol There is no double slash in the robo file you posted. The Boe Bot is running with the following code loaded on it and the robo code attached.
' {$STAMP BS2}
' {$PBASIC 2.5}

Hi STeven
I will make a video and post it on you tube so you can see whats going on. I will try to get it done today.
Tom

Anonymous

12 years

STeven,
We have finaly got the Boe Bot with eb500 bluetooth working perfectly.It works perfectly with the color tracking tutorial. With your help and that of Jeff who has some posts here related to the same project, it is working. We made some changes to the vb script as well as the Bs2 code and the send sequence. The changes are as follows:

' get the size (width or height) of the current
' bounding box
size = GetVariable("COG_BOX_SIZE")

' if it is equal to "" then no object was detected
if size <> "" then

' get the horizontal center of gravity found by the COG
' module
cogX = GetVariable("COG_X")
' if it is less than 75 the blob is on the left side
' of the screen so move that way
if cogX < center-5 then
left_base = 750-(center-cogX)/2
right_base = 750
' otherwise move to the right if above 85 pixels (and no
' movement if 75 < cogX < 85 )
elseif cogX > center+5 then
left_base = 750
right_base = 750-(cogX-center)/2
end if

' if the ball is too close then we have to move backwards
if (size>90) then
left_motor = left_base-((40-size)*2)
right_motor = right_base+((40-size)*2)
' otherwise move forward
else
left_motor = left_base-((size-40)*2)
right_motor = right_base+((size-40)*2)

end if

' set the final motor values to be picked up by
' the SSC module
SetVariable "LEFT_MOTOR", CInt(left_motor)
SetVariable "RIGHT_MOTOR", CInt(right_motor)

end if

send sequence

! [Left_motor] <lf> [Right_motor] <lf>

If you see ways of improving this code we would appreciate anything you can contribute.

Thanks for all your help
Tom

Anonymous

12 years

Tom,

That's fantastic! When do we get to see a video??

The code looks good and we don't have any suggestions at this time. If we think of something we'll post it here!

STeven.

Anonymous

12 years

Hi STeven,
I am working on the video. Of all things to happen I need to get some batteries.....lol I should have some by this evening.
Tom

Anonymous

12 years

Hi STeven,
Here is the address of the video. I did some more fine tuning of software.
http://www.youtube.com/watch?v=mngim02Cqec
Tom

Anonymous

12 years

Hi Guys,
I am working on getting the Boe Bot to stay still when no object is detected. Any thoughts?
Tom

Thanks for posting the video above!! It shows some nice control of the BoeBot using video. Is that a kitty-cat toy that you are using for the red ball? I'm enjoying the comparison of play with your robot like playing with your cat :-)

Its interesting in that using the size of the red ball one can do a simplistic depth perception in that the robot will move forwards and backwards based on the size of the ball. Perhaps you can now turn the BoeBot into a soccer playing robot?

Also which camera did you use on the BoeBot?

Great stuff!
STeven.

Anonymous

12 years

Hi STeven,
Thanks for the advise, I think I will have to set motors to 750 near end of code. The ball is styrofoam painted red on a shish kabob skewer. The camera is one of those cheap spy cams from ebay ( about $30.00 ) with receiver. I'm not sure if you can get those cams with different frequencies, but the Soccer Boe Bot sounds like fun project.
Tom

Anonymous

12 years

Here is an update to vb script program for color tracking Boe Bot. Some bugs have been worked out.

' get the size (width or height) of the current
' bounding box
size = GetVariable("COG_BOX_SIZE")

' if it is equal to "" then no object was detected
if size <> "" then

' get the horizontal center of gravity found by the COG
' module
cogX = GetVariable("COG_X")
' if it is less than 75 the blob is on the left side
' of the screen so move that way
if cogX < center-5 then
left_base = 750-(center-cogX)/2
right_base = 750
' otherwise move to the right if above 85 pixels (and no
' movement if 75 < cogX < 85 )
elseif cogX > center+5 then
left_base = 750
right_base = 750+(cogX-center)/2
end if
' if the ball is too close then we have to move backwards
if (size>90) then
left_motor = left_base+((40-size)*2)
right_motor = right_base-((40-size)*2)
' otherwise move forward
else
left_motor = left_base-((size-40)*2)
right_motor = right_base+((size-40)*2)
end if
' set the final motor values to be picked up by
' the SSC module
end if
if (size<20) then
left_motor=750
right_motor=750
end if
SetVariable "LEFT_MOTOR", CInt(left_motor)
SetVariable "RIGHT_MOTOR", CInt(right_motor)

Anonymous

12 years

Hi Guys,
Heres a new video of Bluetooth Boe Bot with Pan and Tilt accessory running with Roborealm.

Very cool!! Can you explain or do you have a link that describes the pan/tilt system more? Perhaps a quick parts list of how you've accomplished this would help others achieve the same thing!

Nice!

STeven.

Anonymous

12 years

Hi STeven,
The parts for the pan and tilt are cnc machined from expanded pvc. The unit uses 2 mini servos and a spycam I purchased on ebay. The bumper uses 4 small springs and 4-40 screws. The super bright leds were purchased from ebay as well. The whole assembly minus the cam ( cam availible seperatly on ebay ) is availible on ebay, but for those who wish to make their own see the attached pics and email me if you have any questions.

I am still trying to wrap my head around serial communications. I don't see where the "[test]\n" in the receive sequence of the serial command is doing anything in this boe bot communication. Why would the \n be in there in the first place? In the serial communications section, it mentions it in examples, but I find them hard to understand. I'll quote them here:
"
[binary_input_1]:\[binary_input_2]

which would read binary numbers delimited by ':' and ended with \r into the two variables (\1024:\667\n) but

[ascii_input_1]:[ascii_input_2]

would read in two ascii numbers into the two variables (1024:667\n). "

I have tried transmitting the \n to roborealm, but maybe I am not doing it right.

Also, when I run the boe bot .robo file "test" doesn't show up as one of the variables. What is the preferred method of initializing this variable? Would it show up if I ever got it to write?

As mentioned in an earlier thread, I am trying to write a value to a variable from a propeller microcontroller, I can see the correct inputs in hyperterminal, but I am doing something wrong in roborealm because it never correctly sets the variable.

I hope this is not too much of a threadjack, but I wanted to respond in the same thread as the .robo files in question.

Anonymous

12 years

grindel,

The difference between the two is that the // mean that a binary number (4byte number) will be transmitted as apposed to a variable amount depending on the size of the number being transmitted in text.

The \\n is the escape sequence for a newline that indicates the end of a text message that should be read into [test].

Thus the line

[test]\\n

will read in anything sent from the BoeBot until a newline is seen. Then it will start reading again and again for as many messages come from the BoeBot overwriting the value within the variable "test".

Keep in mind that the \\n is actually just a single byte.

Note that the "test" variable will only be created when something was read.

Does that make any better sense?

STeven.

Anonymous

11 years

Ok, steven... Hmmm so this [test]\n should be in the large box under receive sequence, in the roborealm serial module? For some reason, it is saying that it is connected to my BS2 board, and I am sending from the BS2 board, but the variable -test- is not being created, and I have tried this about a thousand different ways.... in my BS2 code, I am sending the dec number 65, over and over, and never seeing the -test- variable created... I'm not sure that I understand how the receive section of the serial module actually works, or how to correctly use the insert field, if the module is going to create the variable when it receives the information... Does any of this make any sense?

Anonymous

11 years

Correct, it only creates the variable when it receives the data. One thing to note is that based on [test]\n RoboRealm will wait for a newline to signal the end of the value for 'test'. Thus you will need to send 65 and then 10 in order to signal the end of the variable. OR you could specify \[test] without the \n and with a single '\' in front of it. This tells RoboRealm that the variable test should be created using a single byte that is received from the serial stream. If you want to use 4 bytes (a word) use a double '\\' instead.

Does this help?

STeven.

Anonymous

11 years

I dunno, I am still having problems, and it must be something simple.... I cannot get the variable to create, and thus no data.... I will attach my simple test code here:

STAMP CODE:

' {$STAMP BS2}
' {$PBASIC 2.5}

st:
SEROUT 16,16468, [DEC 65, 10]
GOTO st

The way that I am understanding the 16468, should be the 8 data bits, with no parity, the 16 should be the correct pin, although I have tried others...

and the simple robofile is also attached here:

It must be something really simple that I am doing wrong, but for the life of me, I have not been able to figure what I am continually doing wrong.

It is a rather long thread, so appologies in advance if I am way off base, but isn't the idea for the Stamp to "read" the serial string from RoboRealm? That is, shouldn't you be using SERIN, not SEROUT?

Anonymous

11 years

I'm sorry Steve, I should have clarified a little better in the post, I just jumped in on this thread at the end, and am not the original person that posted. my issue is getting information from the stamp. I am working on having the stamp read information from sensors, and then input that data into RR. In my little example, I am trying to send the number 65, and have it read by RR, and stored as a variable. If you could look at my examples, and tell me why I am not getting a variable generated that holds the value, sent from the stamp, I would be extremely grateful. Sorry again, that I didn't clkarify a little better, but the thread seemed to be dealing with similar issues, and I was trying to avoid starting another thread.... Ooops!

' get the size (width or height) of the current
' bounding box
size = GetVariable("COG_BOX_SIZE")

' if it is equal to "" then no object was detected
if size <> "" then

' get the horizontal center of gravity found by the COG
' module
cogX = GetVariable("COG_X")
' if it is less than 75 the blob is on the left side
' of the screen so move that way
if cogX < center-5 then
left_base = 750
right_base = 750-(cogX-center)/2
' otherwise move to the right if above 85 pixels (and no
' movement if 75 < cogX < 85 )
elseif cogX > center+5 then
left_base = 750+(center-cogX)/2
right_base = 750

end if
' if the ball is too close then we have to move backwards
size = GetVariable("COG_BOX_SIZE")
if (size > 60) then
left_motor = left_base+((60-size)*2)
right_motor = right_base-((60-size)*2)
else
left_motor = left_base-((size-60)*3)
right_motor = right_base+((size-60)*3)
end if
' set the final motor values to be picked up by
' the SSC module
end if
if (size<10) then
left_motor=750
right_motor=750
end if
SetVariable "LEFT_MOTOR", CInt(left_motor)
SetVariable "RIGHT_MOTOR", CInt(right_motor)
' now lets work on the tilt ... grab the current
' tilt value
tilt = GetVariable("TILT")
' if it was not set then default to 700 (in our case
' this is horizontal to the floor)
if tilt = "" then
tilt = 700
end if

' if the blob is below 55 then tilt down up a bit more
' otherwise tilt up a little more
cogY = GetVariable("COG_Y")
if cogY < 55 then
tilt = tilt - (60-cogY)/5
elseif cogY > 65 then
tilt = tilt + (cogY-60)/5
end if
' we don't want to look up more than horizontal to the
' floor as we don't expect the
' ball to be on the ceiling
if (cogY<5)or(cogY>105) then
tilt =700
end if

' and set that value for the bs2
SetVariable "TILT", CInt(tilt)

Anonymous

11 years

If I remember correctly , This was the send sequence I used.

! [Left_motor] <lf> [Right_motor] <lf> [Tilt] <lf>

I am sorry I have not posted this sooner. I have been away taking care of my mom who was battling cancer. She is doing fine now.
Tom A

Anonymous

11 years

I'm trying to do the same and I'm having some trouble. I used the exact code above and roborealm shows that it recognizes the ball I'm using and my BOE even flashes continuously. But nothing happens.
One reason that nothing is happening is probably because I'm not using the eb500 properly. I know that the eb500 allows for the pc to communicate to the board wirelessly, but I just want to have the boebot connected via serial. How would the code be different?

I think the code should be the same... double check your settings in the "Serial" section to make sure you are actually communicating with all the correct settings (speed, port, etc.).

Anonymous

11 years

thanks for the reply! I got it working!
However, when I tried using the eb500 instead it didn't work. When I ran the .robo roborealm comes with the error that roborealm needs to close. I know that the eb500 is connected to the pc and I ran the exact vb code and .robo that you had.
Do you know why it freezes?

Thanks for the help!

Anonymous

11 years

the .robo file you posted a few post prior also freezes up on roborealm. I'm sure it ran fine on your pc. What could be the problem?

Anonymous

11 years

I've managed to fix the freezing up problem. Seems to have been caused by problems with my bluetooth adapter. The Boebot can move, but it only move forward and not back. Any help?

Anonymous

11 years

Can you post the code you are using. I started this thread and have a robot set up that I can test your code on.
Tom

Anonymous

11 years

I basically built my boebot off of yours. And because nothing is fully functional yet, I have not added anything. I only altered the camera size.
On another thread I talked about another issue that I had. The frame rate greatly decreases with this code. Can you run it and see if that happens for you? Thanks!

btw, that bot of yours looks awesome!
I tried troubleshooting a bit more. And it seems like after I finally resolved my bluetooth issues, the fps is now always low(instead of before where only if the ball goes off the camera then roborealm starts lagging). Because of the constant lag, the boebot no longer moves at all. If this code works for you, would that mean that I have a camera issue?
Again, thanks for your help

Anonymous

11 years

more updates...
If I decrease the baudrate to 2400 instead of 9600, it seems like(at least for now) that the lag has stopped. Even the serial modules shows that the positions are being transmitted. However, the boebot does nothing!

are you sending a "!" as part of your SEROUT? Are you sure that 396 is the correct value for receiving a 2400 baud signal?

Anonymous

11 years

i have a table which translates that for 8 data bits, no parity through line driver, the val is 396 for 2400 baud.
I am sending
! [Left_motor] <lf> [Right_motor] <lf>
like Tom did.
And this used to work. But now even though the console shows that it is being sent and even the eb500's light is on, the bot still doesnt move.

Anonymous

11 years

I notice that different things happen if I change the COM port. Just want to check that the outgoing port is the correct one to use for serial

Anonymous

11 years

ok, after further hacking I finally got it back to the way is was b4. Now it still has problem in going other directions. Here is the .robo with moving forward and backward commented out(it only has the turn towards red ball function).

Hello, I followed the "Color Object Tracking" tutorial and I also reviewed this post. After that I have created the roborealm project and the boebot doesn't work,doesn't move anything. I don't understand why it's happens. I use the serial comunications without eb500.
I have upload my project. can anybody look my project and say me if all is good?

Yes, two current issues. One, you need to specify 9600 buad in the serial module .. it seems that you did not have anything set when we loaded in your robofile.

Second, the SERIN command needs a 16 instead of a 0 as the first parameter since you are using COM1 or the physical connection. 0 works with the bluetooth but you need 16 if you are to run it over the debugging COM1.

We will continue to investigate your script further as even when it does communicate with the boebot it does not appear to be sending out the right motor values.

I have changed the buad to 9600 and I have used the parameter SERIN 16 in Bs2,but the boebot doesn't stop to move in circles. After I have read this post,now the boebot is working well.

I want to do the wireless connection , and I want to add a wireless cam, too.
I know I have to buy the bluetooth adapter eb500, a bluetooth adabter for pc, a wireless cam but how does it connect to PC?
Can you tell me the components that I need, please?

Finally, I change the Serin to 0. In Serial communications I can't select port com, because I will use bluetooth. Do I use the USB_HID in Roborealm?

Thank you

Anonymous

11 years

Edward,

The camera would need to transmit its signal back to the PC and then a USB digitizer will be needed to get the video into the PC. So you need two components like:

The other alternative to the recommended USBLIVE product noted above is to use a TV Tuner video card. Hauppauge makes one and I've been using it on my laptop with no problems.

Anonymous

11 years

Good morning, I am using a bluetooth and eb500 with windows vista system. Every time that I click "run" the program tell me "Could not find the file ScriptSite.dll Please place in the c/windows/system32 You will find the ScriptSite.dll in the roborealm folder". After this I copy and paste this file in the folder system32 but always it tell me the same, and I can't sent date to Boe.

' get the size (width or height) of the current
' bounding box
size = GetVariable("COG_BOX_SIZE")

' if it is equal to "" then no object was detected
if size <> "" then

' get the horizontal center of gravity found by the COG
' module
cogX = GetVariable("COG_X")
' if it is less than 75 the blob is on the left side
' of the screen so move that way
if cogX < center-5 then
left_base = 750
right_base = 750-(cogX-center)/2
' otherwise move to the right if above 85 pixels (and no
' movement if 75 < cogX < 85 )
elseif cogX > center+5 then
left_base = 750+(center-cogX)/2
right_base = 750

end if
' if the ball is too close then we have to move backwards
size = GetVariable("COG_BOX_SIZE")
if (size > 60) then
left_motor = left_base+((60-size)*2)
right_motor = right_base-((60-size)*2)
else
left_motor = left_base-((size-60)*3)
right_motor = right_base+((size-60)*3)
end if
' set the final motor values to be picked up by
' the SSC module
end if
if (size<10) then
left_motor=750
right_motor=750
end if
SetVariable "LEFT_MOTOR", CInt(left_motor)
SetVariable "RIGHT_MOTOR", CInt(right_motor)
' now lets work on the tilt ... grab the current
' tilt value
tilt = GetVariable("TILT")
' if it was not set then default to 700 (in our case
' this is horizontal to the floor)
if tilt = "" then
tilt = 700
end if

' if the blob is below 55 then tilt down up a bit more
' otherwise tilt up a little more
cogY = GetVariable("COG_Y")
if cogY < 55 then
tilt = tilt - (60-cogY)/5
elseif cogY > 65 then
tilt = tilt + (cogY-60)/5
end if
' we don't want to look up more than horizontal to the
' floor as we don't expect the
' ball to be on the ceiling
if (cogY<5)or(cogY>105) then
tilt =700
end if

I saw this code in a previous post. He say that introduce in BS2 SetVariable "TILT", CInt(tilt) but the Stamp editor has a error.

How can I insert the tilt variable in Bs2?

Thank you very much

Anonymous

11 years

Anonymous,

Try to use

regsvr32 ScriptSite.dll

in one of those folders. That will tell the Windows OS to register that component. OR try running RoboRealm as an Administrator at least once and it will try to do that too. (See the FAQ for more information)

The SetVariable is in RoboRealm in the VBScript module NOT in the BS2 code.

The two parts you have there seem about right. The part that you are missing is in the serial communication to the boebot. I assume you are using the serial module to send commands to the boebot. You will need to modify that send sequence to include the Y or tilt component.

Hello Steven, I have changed the program but it doesn't work correctly. When I click "run" in RR the boe moves but after the 3 servo (vertical tilt movement) it gives a strong turn and later doesn't work anything.
I'm using the eb500,a battery of 9v, two servos (x,y) and a miniservo (tilt).

You have my project here, could you please take a look at it, to know if there are any mistakes?

I want to get the light intensity values of a photo resistor loaded on the Boe-Bot but I am not getting a handshake if I add code to receive 2 more values of buffer in basic stamp. Has anyone done that before?

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.

about us

The RoboRealm application was created back in 2006 to take advantage of (1) lower cost generic
computing (i.e. PCs), (2) a widening range of lower cost imaging devices, (3) an increasing need
and usage of vision as primary sensor device and (4) the desire to quickly research custom solutions
using an interactive user interface with minimal programming.