Bluetooth and Roborealm
I am struggling to use roborealm's serial command function with my blue tooth. I have the following running on my bs2. I can connect eb500 with roborealm and send variables to the right com port, but my boe bot just jerks around in circles. Can anyone tell me what I'm doing wrong?
Thanks
Tom
'
[noparse][[/noparse]I/O Definitions]
LMotor CON 15
RMotor CON 14
'
[noparse][[/noparse]Constants]
'
[noparse][[/noparse]Variables]
left_motor VAR Byte
right_motor VAR Byte
'
[noparse][[/noparse]Initialization]
Initialize:
'Wait for the eb500 radio to be ready
PAUSE 1000
'Set the initial state to hold
left_motor = 750
right_motor = 750
GOTO main
'
[noparse][[/noparse]Main Code]
Main:
'Wait for a command
SERIN 0,84, [noparse][[/noparse]DEC left_motor,right_motor]
PULSOUT LMotor,left_motor
PULSOUT RMotor,right_motor
GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.
Post Edited (T0m) : 4/11/2007 7:47:06 PM GMT
Thanks
Tom
'
[noparse][[/noparse]I/O Definitions]
LMotor CON 15
RMotor CON 14
'
[noparse][[/noparse]Constants]
'
[noparse][[/noparse]Variables]
left_motor VAR Byte
right_motor VAR Byte
'
[noparse][[/noparse]Initialization]
Initialize:
'Wait for the eb500 radio to be ready
PAUSE 1000
'Set the initial state to hold
left_motor = 750
right_motor = 750
GOTO main
'
[noparse][[/noparse]Main Code]
Main:
'Wait for a command
SERIN 0,84, [noparse][[/noparse]DEC left_motor,right_motor]
PULSOUT LMotor,left_motor
PULSOUT RMotor,right_motor
GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.
Post Edited (T0m) : 4/11/2007 7:47:06 PM GMT
Comments
As written, the left_motor and right_motor variables should be declared as WORD variables since the values are greater than 255. Once you do that I'd use the SERIN command followed by a DEBUG to see that you're receiving what you expect to receive. Additionally, check to see how the SERIN command needs to be used to receive WORD-sized variables. Start with the little pieces and build into the larger program by making one thing work at a time.
There's another approach, too. Why not configure RoboRealm to send byte variables only and do the math in a BASIC Stamp. From the demo I saw the other day, you could configure RoboRealm to send 0-255 values to the BASIC Stamp. Do the math in the BASIC Stamp to add or subract the values to your left_motor and right_motor variables. Receiving bytes instead of words could reduce the SERIN command time requirements and make the robot less jerky, too.
I'm sure there's more, but just thought I'd throw out a couple of probable fixes.
Ken Gracey
Parallax
Jeff T.
'{$STAMP BS2}
'
[noparse][[/noparse]I/O Definitions]
LMotor CON 15
RMotor CON 14
'
[noparse][[/noparse]Constants]
'
[noparse][[/noparse]Variables]
x VAR Word
y VAR Word
'
[noparse][[/noparse]Initialization]
Initialize:
'Wait for the eb500 radio to be ready
PAUSE 500
'Set the initial state to hold
x = 750
y = 750
GOTO main
'
[noparse][[/noparse]Main Code]
Main:
'Wait for a command
SERIN 0,84,[noparse][[/noparse]DEC x,y]
PULSOUT LMotor,x
PULSOUT RMotor,y
GOTO Main
This is the vb code running on roborealm
' initialize our start motor values to neutral
· left_base = 750
· right_base = 750
· ' 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 eb500 module
··· SetVariable "LEFT_MOTOR", left_motor
··· SetVariable "RIGHT_MOTOR", right_motor
·· end if
Attached is a screen shot of serial setting window in roborealm.
If anyone can help I would appreciate it
Thanks
Tom
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.
Post Edited (T0m) : 4/12/2007 3:55:31 AM GMT
Tom
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.
Main:
'Wait for a command
SERIN 0,84,15,time_out,[noparse][[/noparse]DEC x,y]
time_out:
PULSOUT LMotor,x
PULSOUT RMotor,y
PAUSE 15
GOTO Main
play with the timeout and pause and see what results you get.
Jeff T.
With your help I am much closer to getting it right. Now it actually responds to movement of the green ball. The only thing left to work on is backing up when ball is brought too close. Thanks a million for your help. I have been at this for days. Although it does not seem to be using the exact variable values yet it is a great improvment.
Thanks Again
Tom
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.
Jeff T.
Tom
Update: My eb500 works perfectly. It was a change that Microsoft made to thier MSRS 1.5 version that caused the problem switched back to version 1.0 and everything works great.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.
Post Edited (T0m) : 4/25/2007 11:58:02 PM GMT
I don't think your eb500 is bad. That fact that the Boe-Bot beeped twice means that communication between MSRS and the Boe-Bot is working fine in both directions.
Here are a few things to try. If they don't work, use my email address (use email button to left of this post) to arrange a phone call and we'll find out what's going on.
- Make sure the switch on the Board of Education is in position 2. (Even after all the hours I've logged with the Boe-Bot, I've still let the power switch lead me to some incorrect assumptions.)
- Make sure you are using new alkaline batteries. Rechargeable batteries don’t add up to enough voltage in the 4-cell pack that comes with the Boe-Bot. (The symptoms you described earlier regarding halting action are a common indication of brownout due to either rechargeable or low batteries.)
- Try the attached code to make sure your servos are working.
- Re load BoeBotControlForMsrs.bs2 into the Boe-Bot.
- Make sure you are using the MSRS command prompt to open BASICStamp2.cs
- Do not try to use an MSRS dashboard control that's still open from a previous attempt.
- Make sure you have MSRS (1.0).
- Work from the 1.4 version of our MSRS PDF instructions.
- Make sure both instances where you set the serialport parameter in the MSRS code have the correct COM port number. (BASICStamp2.cs and Parallax.BoeBot.Config.xml)
- The BASICStamp2 project should be in bold print in the Solution Explorer indicating it's the startup project.· If not, right-click it and select set to Startup Project.
- After the two blinks/beeps, compare your Dsshost window to the one on page 9 of our PDF instructions.
- There's a little margin that can appear between your web browser’s buttons and address bars and your web page content telling you that your web browser is blocking scripts. If that appears, click it and tell it to permit scripts for this session.
- After entering localhost and 50001 in those two fields, a "/drivedifferentialtwowheel" entry should appear below it. IMPORTANT: Make sure to double-click that entry.
- Then, click the drive button.
At that point you should be able to use the eyeball control to guide your Boe-Bot.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 4/15/2007 6:30:10 PM GMT
Thanks for the quick reply. I have done all the obvious things. I have changed batteries, changed computers, used a different boe bot, updated all software for bluetooth dongel and I was even concidering a garlic necklace and rabbits foot in my pocket.....just kidding. I will go over it all again today and let you know what happens. Thanks
Tom
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.
Aside from the garlic necklace and rabbit foot, keep a close eye on the sequence of clicks leading up to using the eyeball control.
I forgot to mention to make sure _autonmode is set to false in BoeBotControl.cs.
Also, if you get no luck from the SimpleDashboard Eybeall control, another thing to try would be the Robotics Tutorials starting on page 14 of MSRS-Bluetooth-Boe-Bot-v1.4.pdf.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Thank you for your help getting this problem solved. Although I was convinced that there was somthing wrong with my eb500,·your systematic·approach to·solving the problem proved to be much more concise then my throwing my hands in the air. I have learned more about patience and clear thinking for myself. And even more about the reliabilty of Parallax products.
Thanks Again
Tom
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Robot vision is the the future, and Vision will take us there.