if(command = 1) then              ; Walk Forward
     gosub movement  7.0,-20.0,-20.0, -7.0, 20.0, 20.0, 500.0]
     gosub movement -7.0,-20.0,-20.0, 7.0, 20.0, 20.0, 500.0]
     gosub movement -7.0, 20.0, 20.0, 7.0,-20.0,-20.0, 500.0]
     gosub movement  7.0, 20.0, 20.0, -7.0,-20.0,-20.0, 500.0]
I’m new to robotics. I’ve bought a BRAT Autonomous from LYNXMOTION.
Can anyone please explain me the code and how it works? I’ve the code but I don’t know how it works or in which sequence it works. I need someone to explain me the program step by step. I don’t know how the above patch of program executes. First hip or ankle? What do these values indicate?
I also need someone to tell me how I can edit the program to my preferences. Please help me out. I know to edit the execution part that is between main and move label. But if I want my brat to do something else other than the predefined commands like walk, turn etc. How do I do it? How do I edit  the servo motor part in the program?
The function Movement takes seven variables, which the first six are the desired new Angles (in this version degrees) for Right Ankle, Knee, Hip, Left Ankle, Knee, Hip and the last variable is the amount of time to take to get to these new Angles, in the cases above 500 is a half a second. In the Walk forward you show above in the four steps:
Lean one direction (by tilting the ankles) and move one leg up and forward.
Lean the other direction
Lower and move back the first leg you put up and raise the other leg and move it foreword
lean the other way
If you continue to walk it will then continue back to step 1…
To change how it moves you need to come up with your own sequences and figure out the angle for the 6 servos and how long it should take…
Note: in the above I have treated the Movement function as a black box and not explained how it does its work, as I believe you are mainly asking about how to develop your own sequences.
The - indicates a negative angle. Standing straight up, each joint of the BRAT is at 0°. To move a leg forward you’d use a positive number, or a negative number to move it backwards. It’s been a while since I’ve used the code, so that might be backwards, but the point is that gosub movement 7.0,-20.0,-20.0, -7.0, 20.0, 20.0, 500.0] would put one leg 20° forward and one 20° back.
Just experiment. You can use values from -90 to 90.
[code]if (((lastir - ir) > -500) AND ((lastir - ir) < -200)) then;Surprise!
   command = 15
   gosub move
  Â
   sound 9,[70\4400]
   pause 35
   sound 9,[45\3800]
   pause 50
   sound 9,[50\3900]
   pause 35
   sound 9,[50\3800]
   pause 35
   sound 9,[70\4300]
   pause 35
  endif
It looks for the condition where the distance sensor goes from nothing in the view to something very close in a rapid fashion. Then the robot moves in a “startled” way. It’s a behavior.
Your not ready to worry about other sensors. First, your goal should be to understand the code and how it does what it does. A problem a lot of beginers face is trying to take on to much at once. Try to learn the basics of the programming language and then you can take the next step. What have you tried so far and what were the results?
If I want to rotate the head clockwise and anti clockwise using the buttons of ps2 controller can I write this program initially initialize
pos=0;
under L2 button pos = pos -1;
under R2 button pos= pos+1;
hservo[head\ (pos * 100) \ 255]
Will it work? Or should I add or copy any other statement from the autonomous bottle kicking program.
Hi,
I need to know whether the software can be installed in more than 1 computer, if i install the sequencer in a computer and unfortunately i’m forced to format my hard drive, can i install it again with the help of the CD… pls help me
I have not been following this thread, but from what I have read:
Yes - you need to declare the variable pos. From what Robot Dude posted it has a value between 1000 and 2000 so it needs to be at least a word. (pos var word)
You will also need to define “head” which probably is a constant but could be a variable. It should be defined to have the pin number that you plug the head servo into.
The HSERVO command is described in the “Basic Micro Syntax manual” that you open from the help menu of the Basic Micro IDE. I believe it is on page 123 of the current manual.
In this case the command:
hservo[head\ (pos * 100) \ 255]
Says to move the servo defined in the variable or constant named head (mentioned above), to the position pos*100 with the speed value of 255.
You should be able to reinstall SEQ as long as you have the CD and the serial number.
HI…
How can i increase the speed of rotation of the head…?
I currently use this code
If I want to rotate the head clockwise and anti clockwise using the buttons of ps2 controller can I write this program initially initialize
pos=0;
under L2 button pos = pos -1;
under R2 button pos= pos+1;
hservo[head\ (pos * 100) \ 255]
if (ir > 250) then
detect = true
endif
sound 9,[100(ir * 10)] ;beep in between steps, higher pitch for closer obstacles.
if detect then
low 14 ;turn the yellow LED on
command=2 ;back up one step
gosub move
command=11 ;turn left two steps
for xx=1 to 2
gosub move
next
detect = false
input 14 ;turn the yellow LED off
else
low 12 ;turn the red LED on
command=1
gosub move
input 12 ;turn the red LED off
endif
what does this patch of program do??
how can we give the ir value? What does that ir value indicate?
what is the max value?