Shop OBEX P1 Docs P2 Docs Learn Events
Roborealm can't connect with boe-bot (serial port) — Parallax Forums

Roborealm can't connect with boe-bot (serial port)

EduEdu Posts: 12
edited 2008-09-30 04:23 in Robotics
Good morning, I am following the "Why track colors?" tutorial to do a school project with my boe-bot. In the Roborealm I have added The RGBFilter, the Center of Gravity, the mean filter,the VBScript Program, the serial communications and parallax_boebot.
Now, I am lost because I do not know how does roborealm communicate with boe-bot. Could anybody tell me?
I have inserted in the boe-bot this code with basic Stamp :

' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM1}
x VAR Word
y VAR Word
main:
SERIN 0,84,[noparse][[/noparse]WAIT ("!"),DEC4 x,DEC4 y]
PULSOUT··14, x
PULSOUT··15, y
PAUSE 5
GOTO main
..............................................
After that, I have added the VBScript Program in the Roborealm program with the next code:


··' initialize our start motor values to neutral
··left_base = 750
··right_base = 750
··' get current image size
··width = GetVariable("IMAGE_WIDTH")
··center = width / 2
··' 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
········SetVariable "LEFT_MOTOR", CInt(left_motor)
····SetVariable "RIGHT_MOTOR", CInt(right_motor)
····
end if

serial send sequence for Roborealm:

! [noparse][[/noparse]Left_motor] <lf> [noparse][[/noparse]Right_motor] <lf>
........................................................

Next, I have inserted serial communications and finally I have added parallax_boebot. After doing these things the boebot doesn't move, it might be some error of configuration.

can anybody help me, please?


Thank you very much

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-08-07 00:51
    Hi Edu, the code you list is meant to be used with the Roborealm serial communications , so if you added the parallax_boebot control that control needs to be removed.

    I'm not sure if you have done this or not but the last line of the VB script you listed (! [noparse][[/noparse]Left_motor] <lf> [noparse][[/noparse]Right_motor] <lf>) is the code to place in the serial control not the VB script, I believe the spaces are an important part of the format too.

    Jeff T.
  • EduEdu Posts: 12
    edited 2008-08-07 13:22
    Hi Unsoundcode, I have removed the parallax_boebot control and I have eliminated the last line of the VB script. After that I have written (! [noparse][[/noparse]Left_motor] <lf> [noparse][[/noparse]Right_motor] <lf>) in the serial control. The result is not good. I can see the numbers that roborealm is sending to the serial control but the boebot doesn't work.

    I don't know where is my mistake.


    Thank you
  • EduEdu Posts: 12
    edited 2008-08-10 10:49
    Hello, I have improved the project but the boebot doesn't work when Roborealm is sending the signal.
    I have upload my project in this server: http://www.megaupload.com/es/?d=4W247RJR
    Could you review if there is some mistake, please?

    I am very grateful with your help.


    Thank you
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-08-10 19:02
    Hi Edu, I am not set up to try this unfortunately but I did look at your "program.robo" the only thing I can suggest is to review the serial strings, if I remember rightly the string should have the spaces I have highlited in red· ! space [noparse][[/noparse]Left_motor] space <lf> space [noparse][[/noparse]Right_motor] space <lf> and don't forget to include the exclamation on the front end.· I would get rid of the receive sequence ([noparse][[/noparse]test]\n) until I had established the send sequence was working. Try a lower baud rate and see if the results are any different. I saw you have posted on Roborealms forum did you by any chance read the following thread on that same forum http://www.roborealm.com/forum/index.php?thread_id=721# it goes into great detail.

    Jeff T
  • EduEdu Posts: 12
    edited 2008-08-12 10:02
    Hello, I have thought that the best is try with Bluetooth conections (eb500). I don't know how it is configurate, anybody can say me the configuration for eb500 in roborealm? have I add USB_HID using bluetooth? what are the parameters?

    Thank you -Edward-
  • TomvnTomvn Posts: 103
    edited 2008-09-30 04:23
    Edu
    the problem in Bs2 code
    fix the Pin to 12,13 for boebot.
Sign In or Register to comment.