Shop OBEX P1 Docs P2 Docs Learn Events
Bluetooth and Roborealm — Parallax Forums

Bluetooth and Roborealm

T0mT0m Posts: 124
edited 2007-04-16 22:48 in Robotics
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

Comments

  • Ken GraceyKen Gracey Posts: 7,392
    edited 2007-04-11 19:53
    Hey Tom,

    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
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-04-11 19:54
    Hi Tom, one thing I see is that left_motor and right_motor need to be words not bytes.

    Jeff T.
  • T0mT0m Posts: 124
    edited 2007-04-12 03:32
    ok this kinda works but its not quite right. ant suggestions.

    '{$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
    1024 x 768 - 96K
  • T0mT0m Posts: 124
    edited 2007-04-12 20:26
    Thank You Ken and Jeff for your input. I have made some changes but I am still having little luck. Is there anyone out there who has roborealm running with eb500 and BOE?

    Tom

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Robot vision is the the future, and Vision will take us there.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-04-12 21:07
    Hi Tom, I dont know how often RR is transmitting to the Stamp but looking at the code you posted last it seems you might need a serial timeout and a pause in the main loop. You could try it anyway to see if there was an improvement

    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.
  • T0mT0m Posts: 124
    edited 2007-04-12 23:02
    Thanks Jeff !
    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.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-04-12 23:48
    I thought after I posted Tom, if the SERIN times out I am not sure if the x y values retain their value or initialise to 0, maybe someone can answer that. If they do go to 0 you would need a little extra code to ignore the new value and keep the old value in the event of a time out.

    Jeff T.
  • T0mT0m Posts: 124
    edited 2007-04-15 16:18
    After some exhaustive sample code testing I realize that my eb500 is not working correctly. When I initially tried it with MSRS it worked intermittantly and I assumed it was a Microsoft bug in the new software. I tried unsuccessfully to use any other examples from the manual and I assumed it was my inexperience. Now I have tried to use it with MSRS tutorial again and my eb500 does connect and the program does start·as indicated by the 2 beeps and the leds blinking at start of the program. The problem arises when I start the dashboard and try to drive the Boe Bot. No exceptions are thrown and the boe bot does not respond to any movement of the dashboard interface. As I said earlier the dashboard did work intermittently when I first ran the tutorial. Now I get nothing. This combined with the fact that nothing else has worked leads me to believe that my eb500 is bad. The only thing I can add is that My eb500 cer c worked intermittently before I removed pin 3 as per Parallax instructions and did not work properly afterwards. May be a coincidence but I do not have the experience to make a definite determination as to why it stoppped working. I will be returning my eb500 to Parallax for repair or replacement. I have been quite discouraged with my project and I hope to turn that around once I get a good eb500. I hope that the forum uses who have read my posts over the last couple of weeks will forgive my grovelling for answers on this obviously impossible task givin the hardware problem I did not realize that I had.

    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
  • edited 2007-04-15 17:50
    T0m,

    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
  • T0mT0m Posts: 124
    edited 2007-04-15 18:18
    Hi Andy,
    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.
  • edited 2007-04-15 18:40
    T0m,

    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.
  • T0mT0m Posts: 124
    edited 2007-04-16 22:48
    Andy,

    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.
Sign In or Register to comment.