I need a simple code for sequence

Hi my friends, I do not know what happened to my account, but I’m back!
Well, I needed a simple code for the bb2, with the chip ATOM PRO 28 in which to make a programmed sequence and can then change to other functions!

Thanks

Hi KamaS. Welcome back.

I think before anyone can help you here, that they will need additional information.

Things like: When you say a programmed sequence, what do you mean? Are you talking about talking to an SSC-32 board that has sequences stored in it? Or are you talking about some sequence that you wish to program into your Bap28? If so again need lots more info on it.

Also not sure what you mean by saying change to other functions…

Kurt

Hi kurte!

I’ll see if I can explain better, I have a CH3-R with ssc-32 and a bot board II with the chip ATOM 28 PRO!

What I want is a sequence of movements that start the program pushes a button on bb2!

For example, dance or the body up and down, but the servants have to work all!

Thanks

Hi again,

So you have the CHR-3 with a SSC-32 and a Bap28, which is good. Are you using any other controllers on your CHR-3? Something like a PS2? Or are you trying to make the robot completely autonomous. If the later I would first work on getting it to check a sensor or two and start walking…

From your description, I believe that you are wanting to run sequences that are stored on the SSC-32. If so you need to generate the sequences in something like PEP or SEQ and download them to your SSC-32. If instead you are wanting the sequences like some of the canned routines that were included with POWERPOD than you can copy/edit/modify these sequences…

Now what software code are you currently running on your CHR-3. For example have you used powerpod to generate the code? Or are you using the phoenix code by Xan? Version 1.x or 2.x?

If by chance you are using Phoenix version 2.x code on your CHR-3 with a PS2 controller. The code is in place. I think you hit the Cross button on the PS2 controller to enter GP player mode, then you can hit the select button to choose different sequences and the R2 button to start one. Even if you don’t wish to use a PS2 controller, you might want to look at the code here to see how it is done.

Sorry that I can not be very specific, but we need more information.
a) What code base are you starting off with. What have you tried?
b) What other controllers if any are you using.
c) Sequences are code sequences in basic or sequences stored on the SSC-32?

Good Luck
Kurt

Hello

POWERPOD to generate the code in *. bas and send to bb2 by ATOM-PRO IDE and it works!

Let me be more specific, I want to create a sequence of movements without sensors or command of the ps2 and did not want to send the data to the ssc-32, but for the BB2! Is it possible?

For example:

Step 1:
Servo 00
Servo 01
Servo 02

up

Step 2:
Servo 04
Servo 05
Servo 06

down

I apologize for my translation, I’m Portuguese!

No problem :laughing:

OK, so it sounds like the first few hurdles have been taken care of. What options did you give to powerpod? IE did you say it was autonomous or ps2 or… And now can you actually make it do anything yet? If you started off with the autonomous version and have added no code, it probably won’t do anything. There is another current thread (viewtopic.php?f=4&t=5999), where eventually they want the CHR-3 to walk around using sensors, but yesterday I did suggest a little code that maybe got the robot to walk forward if you hit one of the buttons on the Bot Board 2… That code could easily be adapted to run a sequence…

I think you are asking if you can create sequences in the basic code. The answer is yes. In fact there are a few sequences in the powerpod code (attack posture and learn to fly), if you look at the learn to fly code:

if Buttons.bit7 then ; Learning To Fly gosub All1500 ;Learning to fly posture (uh ? nutty ?...it CAN fly...) for Index = 1 to 4 serout SSC32,i38400,"#",MRHV,MRHV2,"P1900#",MRK,MRK2,"P1800#",MLHV,MLHV2,"P1100#", | MLK,MLK2,"P1200T288",13] serout SSC32,i38400,"#",RRHV,RRHV2,"P1600#",RRK,RRK2,"P1600#",FRHV,FRHV2,"P1600#", | FRK,FRK2,"P1600#",RLHV,RLHV2,"P1400#",RLK,RLK2,"P1400#",FLHV,FLHV2,"P1400#", | FLK,FLK2,"P1400T576",13] pause 288 serout SSC32,i38400,"#",MRK,MRK2,"P1200#",MLK,MLK2,"P1800T288",13] pause 288 serout SSC32,i38400,"#",RRHV,RRHV2,"P1400#",RRK,RRK2,"P1400#",MRHV,MRHV2,"P1500#", | FRHV,FRHV2,"P1400#",FRK,FRK2,"P1400#",RLHV,RLHV2,"P1600#",RLK,RLK2,"P1600#", | MLHV,MLHV2,"P1500#",FLHV,FLHV2,"P1600#",FLK,FLK2,"P1600T576",13] pause 576 next serout SSC32,i38400,"#",MRHV,MRHV2,"P1800#",MRK,MRK2,"P1800#",MLHV,MLHV2,"P1200#", | MLK,MLK2,"P1200T288",13] pause 288 gosub All1500 endif
You will see a bunch of code lines that look like:
serout SSC32,i38400,"#",MRHV,MRHV2,“P1900#”,MRK,MRK2,“P1800#”,MLHV,MLHV2,“P1100#”, |
MLK,MLK2,“P1200T288”,13]

These are serial outputs to the SSC-32 card, which all of your servos are plugged into. These outputs tell the SSC-32 to move specific servos to specific locations. To fully understand these commands you are going to need to understand the SSC-32 command sequences, which can be found in: lynxmotion.com/images/html/build136.htm
The above line will output something like: #05P1900#06P1100#22P1200T288
This says move servo 5 to 1900, servo 6 to 1100 and servo 22 to 1200 in 288 milliseconds. The servo positions like 1900 are the width of the pulse that is generated in microseconds. With most servos somewhere very near 1500uS is the center point. The values that are less than 1500 will rotate the servo one direction and above 1500 will rotate the other direction. The valid range depends on the servos. There are several posts and tutorials that describe this in detail.

At the beginning of the above code, it starts with: if Buttons.bit7
This says if in your code you wish to run this sequence, then set this bit and the code will run. So If we modify the code I put in the other thread I mentioned, to something like:

Where the variables are defined:

; mine 
ButA		var bit
Prev_ButA 	var bit
ButB		var bit
Prev_ButB 	var bit

In the main code after the label main and the if test for being initialized and then before the label shunt…

[code];--------------------------------------------------------------------
; mine
Buttons = 0 ; Start off with no buttons pressed.

Prev_ButA = ButA		; remember previous state
ButA = in12				; get the new state of the Btn A on BB2

Prev_ButB = ButB		; remember previous state
ButB = in13				; get the new state of the Btn B on BB2

if ButA and (Prev_ButA = 0) then
	; Toggle the ON/Off switch
	Buttons.bit4 = 1	; Say that we pressed the on/off switch
endif

if ButB and (Prev_ButB = 0) then
	; Toggle the ON/Off switch
	Buttons.bit7 = 1	; Try Learn to fly...
endif

; need to figure out what we want to do but to start off with
; walking forward at some speed and height...		

Steering = 0	; not rotate
XSpeed = 0; 40		; go forward at some speed - 0 to not move...
YSpeed  = 0		; not diagnal...(translation):
Height  = 0
LegUpShift = 40	; higher up but not that it needs extra stuff
GaitSpeed = 10	; somewhere in the middle of speed
KneeShiftOn = 0 ; normal gait
LockLegs = 0	; Normal walk
LeftStickMode = 0 ; probably don't need to set

Shunt
[/code]
Note: the above code compiled, but I did not download or test it, so your may or may not work… Also note I changed the value of XSpeed that I set for the other person to 0 as to not have it walk. The code is sort of set that Button A on the bot board will turn the robot on or off. If On, Button B should do the sequence. Sort-of limited as you only have three buttons on the BB2, but should give you some ideas…

Good luck
Kurt

Thanks Kurt!

I’ll try to experiment, after warning!

Thanks for your help!

Thanks Kurt!

This is what we need!

Now I just have to create new sequences!

Thank you very much!

Closed