|
Roborealm can't connect with boe-bot (serial port) Anonymous |
16 year
|
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,[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:
! [Left_motor] <lf> [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
|
|
|
Steve Joblin from United States [18 posts] |
16 year
|
are you sure that the settings in the Serial module are correct... it is using the correct port, is the baud and other settings the same as what the BOEBot is looing for? I would also make the pause statement in the BOEbot program a bit longer (try 20 ms). Also check the size settings for the camera under Options --> Video tab --> Video format.
|
|
|
Edward from Spain [10 posts] |
16 year
|
Hello, this is my serial configuration.The port com is correct in the serial communications, it say me "connected". I don't know that number put in the baud, now I have the number (115200). Data Bits (8). Parity (None). Stop Bits (1). Console (Ascii).
Initialization Sequence, it's empty. In send sequence, I have "[LEFT_MOTOR] and [RIGHT_MOTOR]. In send Rate I have put "AFAP" and receive sequence it's empty.
Video format; 320x240 , color YUY2, speed of pictures 5000.
by the end, I have also added parallax_boebot, is it correct?
with the next configuration:
Motors: LEFT(COG_Y) RIGHT(COG_X)
Input/output Pins (selected)
14 COG_X (bit 8) OUT
15 COG_Y (bit 8) OUT
Thank you very much
|
|
|
Steve Joblin from United States [18 posts] |
16 year
|
try reducing the video format (I don't remember the numbers, but I think it is the second smallest possible setting).
|
|
|
Anonymous |
16 year
|
Edward,
can you include your robofile so that we can take a look at all your configuration. Just save a file using somename.robo after clicking on the Save button from the main RR interface (it is used for both images and robofiles). In your next post include that filename in the last Browse button when making a post.
Thanks,
STeven.
|
|
|
Edward from Spain [10 posts] |
16 year
|
Hello, the first, I am very grateful for your help.
You have my project here. Could you look if there is some mistake?
Thank you very much. program.robo
|
|
|
Edward from Spain [10 posts] |
16 year
|
Hello. I'm sorry. The last "DOWNLOAD .robo" is wrong.
You have the good project here. Could you look if there is some mistake?
Thank you program.robo
|
|
|
Anonymous |
16 year
|
Edward,
Here's the robofile that we used to test this. Note that we simplified the VBScript file a little to make debugging easier. The program download to the BoeBot is
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Word
y VAR Word
main:
SERIN 0,84,[WAIT ("!"),DEC4 x,DEC4 y]
PULSOUT 14, x
PULSOUT 15, y
PAUSE 5
GOTO main
Note that this assumes BlueTooth (the 0 in SERIN) otherwise you will need to change it to 16 (COM1 connected).
Also note that motors are on 14 and 15 as apposed to 12, 13.
See if this robofile works for you.
Note that the robot should turn to face a red object.
STeven. program.robo
|
|
|
Anonymous |
16 year
|
Hello Steven, Now the boe bot is moving but I have a problem, the boe bot doesn't turn correctly. It only run forward and When the boe doesn't detect the color It is turning left slowly.
What kind of problem is there?
I have changed the object tracking color to blue because it is better than red color.
Thank you very much program.robo
|
|
|
Anonymous |
16 year
|
Edward,
I'd recommend trying to reduce the complexity of the VBScript part and determine what part is doing what. Keep in mind that this script was taken from a motor system that required apposing values on both motors to move forward ... this is not the case with the boebot where two equal values will move it forward. At this point you will have to experiment with the system to determine what you want to do.
We noticed that the current VBScript has been reverted back to the old one as apposed to our simplified version. Thus this is a good time to start experimenting by removing parts of the file that you don't think you need and once you understand what is happening start to add back in the parts to perform certain movements.
STeven.
|
|