Ch3-r dont turn his head correct

hi!
im new here and i have my first really problem with my new (14 days old) ch3-r! i want to give him a head with a little camera! i connect a servo on pin 31 on the ssc32 and now starts the problem:
when the hex start walking to the left-the servo (an older graupner MS-X3 micro servo) turns slowly to the left! thats fine!!! :slight_smile:

but when i turn with the ps2 controller to the right, the servo turns also with max speed to the left??? :cry:
when i turn the controller stick slowly forward–holding forward and turns slowly right the servo goes slowly right but when i ca. 15 degrees before close turn right, the servo goes with max speed also to the left!

who is here the error? must i change something in the programm??
i have really no idea!! please help me!!!

Are you sure the servo is not defective? Also remember the robot can be directed to walk in 360° but the head servo is only 180° so it moves to the opposite side when the robot is moving backwards…

thanks for answering me!!!
im sure that the servo is not defective! i used on the second turn a hs-475hb from a leg and it also doesnt work! my problem is really that the panning servo for the head not turn to the correct right side! he turns to ca 14:30 clock and then hard to the left side! and not further to 3 o clock!

Servos tend to travel hard to one direction when they get bad pulse signals, either due to bad connections or possibly incorrectly generated pulses.

the connection from the servo is good!? i plugged it on pin 31 on the ssc32, the pin who nammed in the powerpod named as panning servo! my battery is full! the other “leg” ports on the ssc32 plugged all correctly and the robot works perfectly! i really found no issue in plugging and mechaic from my side! its really confusing for me!!!

does not anyone have another idea???

At this point, I would probably try something to debug it.

That is: I would probably do something like a:
serout, S_OUT,i9600,[dec Deck_Pulse, 13]

at about where the main serout to the ssc-32 happens and see what the generated pulse is. You may also want to make sure you are configured for 180 degrees and not 360…

Kurt

sorry for my question but who must i change this?

Sorry if I was not very clear in the previous post.

I am not sure if you are now asking why must I change this or maybe how to change it. So I will try to answer both ways…

The idea of my previous post is it may be possible there is a problem in the current program, or maybe it is making assumptions that are not correct for your robot. So the idea is to try to gather additional information to allow yourself or others to have a better idea on how to fix the problem. This is what I meant to debug it.

So the idea is to find in your current program, which was probably generated by powerpod? where you are outputing the command to the SSC-32. The area may look something like:

serout SER_POUT, SER_MODE,"#",RRHH,RRHH2,"P",DEC HipH_Pulse(0),"#",RRHV,RRHV2,"P",DEC HipV_Pulse(0), | "#",RRK,RRK2,"P",DEC Knee_Pulse(0),"#",FRHH,FRHH2,"P",DEC HipH_Pulse(2), | "#",FRHV,FRHV2,"P",DEC HipV_Pulse(2),"#",FRK,FRK2,"P",DEC Knee_Pulse(2), | "#",MLHH,MLHH2,"P",DEC HipH_Pulse(4),"#",MLHV,MLHV2,"P",DEC 3000 - HipV_Pulse(4), | "#",MLK,MLK2,"P",DEC 3000 - Knee_Pulse(4),"#",MRHH,MRHH2,"P",DEC HipH_Pulse(1), | "#",MRHV,MRHV2,"P",DEC HipV_Pulse(1),"#",MRK,MRK2,"P",DEC Knee_Pulse(1), | "#",RLHH,RLHH2,"P",DEC HipH_Pulse(5),"#",RLHV,RLHV2,"P",DEC 3000 - HipV_Pulse(5), | "#",RLK,RLK2,"P",DEC 3000 - Knee_Pulse(5),"#",FLHH,FLHH2,"P",DEC HipH_Pulse(3), | "#",FLHV,FLHV2,"P",DEC 3000 - HipV_Pulse(3),"#",FLK,FLK2,"P",DEC 3000 - Knee_Pulse(3), | "#",DeckP,DeckP2,"P",DEC Deck_Pulse,"#",DeckTilt,DeckTilt2,"P",DEC DeckTilt_Pulse, | "#",LGripOC,LGripOC2,"P",DEC LittleGripOCPulse,"#",LGripLR,LGripLR2,"P",DEC LittleGripLRPulse,"T180",13]
Your code may look different as mine was done awhile ago and then it was converted to run on an Atom Pro instead of the standard atom. It was later again edited to make it work on both the round and inline hex…

Look for the serout command that is outputing the Deck_pulse. Now the idea is for you edit the program and add in an additional Serout command to S_OUT, to display this value. Then you will need to compile and download this updated program and run it, with the serial cable still attached to the BB2 (Atom). You can use several different terminal windows, but the easiest is to use the one that is part of your Atom IDE (the program you compile with). Click on one of the terminal windows at the bottom of the window, select the appropriate COMM port (the one you download with). Choose the baud rate of 9600 and do a connect.

Now run your robot and go to the left and go to the right and note the values output in the terminal window. The value will probably be near 1500 when it is pointing forward. One direction it should go from 1500 up to 2400 and going the other direction go from 1500 down to around 600.
If the values don’t go like this then there may be a program problem. If it goes fine and lets say the value goes from 700 down to near 600 and the servo all of a sudden jumps the opposite direction, then maybe there is a problem elsewhere (SSC-32 or servo…).

With this type of information, the problem can be issolated and fixed or avoided. Example if it works fine going down to 700 but not 600, you could simply update the minumum value (DECK_PULSEMIN)…

I hope that helps.

Kurt

hi! i changed the “serout” command to S_OUT! now looks like this
[/code]
S_OUT SSC32,i38400,"#",RRHH,RRHH2,“P”,DEC HipH_Pulse(0),"#",RRHV,RRHV2,“P”,DEC HipV_Pulse(0), |
“#”,RRK,RRK2,“P”,DEC Knee_Pulse(0),"#",FRHH,FRHH2,“P”,DEC HipH_Pulse(2), |
“#”,FRHV,FRHV2,“P”,DEC HipV_Pulse(2),"#",FRK,FRK2,“P”,DEC Knee_Pulse(2), |
“#”,MLHH,MLHH2,“P”,DEC HipH_Pulse(4),"#",MLHV,MLHV2,“P”,DEC 3000 - HipV_Pulse(4), |
“#”,MLK,MLK2,“P”,DEC 3000 - Knee_Pulse(4),"#",MRHH,MRHH2,“P”,DEC HipH_Pulse(1), |
“#”,MRHV,MRHV2,“P”,DEC HipV_Pulse(1),"#",MRK,MRK2,“P”,DEC Knee_Pulse(1), |
“#”,RLHH,RLHH2,“P”,DEC HipH_Pulse(5),"#",RLHV,RLHV2,“P”,DEC 3000 - HipV_Pulse(5), |
“#”,RLK,RLK2,“P”,DEC 3000 - Knee_Pulse(5),"#",FLHH,FLHH2,“P”,DEC HipH_Pulse(3), |
“#”,FLHV,FLHV2,“P”,DEC 3000 - HipV_Pulse(3),"#",FLK,FLK2,“P”,DEC 3000 - Knee_Pulse(3), |
“#”,DeckP,DeckP2,“P”,DEC Deck_Pulse,"#",DeckTilt,DeckTilt2,“P”,DEC DeckTilt_Pulse, |
“#”,LGripOC,LGripOC2,“P”,DEC LittleGripOCPulse,"#",LGripLR,LGripLR2,“P”,DEC LittleGripLRPulse,“T190”,13]
else
but when i compile or programmed the Atom the BasicMicro software bring errors! i also cleared the ssc32 and the i38400 command! there also errors!! i can not load the programm to the atom! when i chaned back the command it runs without problems!! i could post you a picture on pn!??

Try: serout S_OUT, i9600,"#",RRHH,RRHH2,"P",DEC HipH_Pulse(0),"#",RRHV,RRHV2,"P",DEC HipV_Pulse(0), | "#",RRK,RRK2,"P",DEC Knee_Pulse(0),"#",FRHH,FRHH2,"P",DEC HipH_Pulse(2), | "#",FRHV,FRHV2,"P",DEC HipV_Pulse(2),"#",FRK,FRK2,"P",DEC Knee_Pulse(2), | "#",MLHH,MLHH2,"P",DEC HipH_Pulse(4),"#",MLHV,MLHV2,"P",DEC 3000 - HipV_Pulse(4), | "#",MLK,MLK2,"P",DEC 3000 - Knee_Pulse(4),"#",MRHH,MRHH2,"P",DEC HipH_Pulse(1), | "#",MRHV,MRHV2,"P",DEC HipV_Pulse(1),"#",MRK,MRK2,"P",DEC Knee_Pulse(1), | "#",RLHH,RLHH2,"P",DEC HipH_Pulse(5),"#",RLHV,RLHV2,"P",DEC 3000 - HipV_Pulse(5), | "#",RLK,RLK2,"P",DEC 3000 - Knee_Pulse(5),"#",FLHH,FLHH2,"P",DEC HipH_Pulse(3), | "#",FLHV,FLHV2,"P",DEC 3000 - HipV_Pulse(3),"#",FLK,FLK2,"P",DEC 3000 - Knee_Pulse(3), | "#",DeckP,DeckP2,"P",DEC Deck_Pulse,"#",DeckTilt,DeckTilt2,"P",DEC DeckTilt_Pulse, | "#",LGripOC,LGripOC2,"P",DEC LittleGripOCPulse,"#",LGripLR,LGripLR2,"P",DEC LittleGripLRPulse,"T190",13]

But it would also be good as to not remove the original serout to the SSC32, as to allow it to move and so you can see if and or when it starts to go bad… Also you may not necessarily want to print out everything to the terminal window, but maybe just the deck_pulse to begin with. This is what I had in the earlier post.

serout, S_OUT,i9600,[dec Deck_Pulse, 13]

Kurt

when i walked forward it wrote #31P1492! when i try left the value continusly go down to 600! when i walked right the value goes to 2343 but the controller is not close to right! when i turn really right the the value goes straight to 600!

There could be several things going on here, but my guess is that maybe there is an overflow in the calculation of DEC_PULSE. to try to verify it, we could try to print out some additional information.

In particular, change the debuging serout to maybe:

serout, S_OUT,i9600,[dec dangle, " ", dec Deck_Pulse, 13] 

My guess is that in the statement:

Deck_Pulse = ((Deck_PulseMax - Deck_PulseMin) * ((DAngle + 64 ) & $7F)) / 127 + Deck_PulseMin
where Deck_pulseMax = 2400 and
Deck_pulseMin = 600

The first part of this calculation worst case could be:
(2400-600)*(127)=228600, which
is greater than 65536 which is the largest value a word can hold. I am not 100% sure if the atom will do all of the math as words as that is what the resultant is, or as 32 bits, but for a quick test, you might try changing the deck pulse variable from a word to a long. In particular:

Deck_Pulse var long

Good Luck
Kurt

Mirage, Please help me to remember to email Laurent about this when I get back from our break on Jan 5th.

Hello again!
A Happy new year at all!!!

i chaned in “var long” but i became an error!???

Hi Mirage,

Not sure what you did. Did you simply change the word “word” to “long”?

What was the error?

Kurt

sorry i was wrong!!!
i changend in a worng line!!
i changed now in the right line but there is no effect!!! the servo turns almost “wrong”! and the commands in the terminal almost the same bevor i changed the word to long…

Did you by chance change the debug printing to include the DANGLE as I mentioned earlier. Did you note what the value of dangle was when the values went bad?

You might also try playing with the calculation of Deck_pulse to see if the value being generated near where it goes bad is overflowing or if the calculation is wrong. If doing it on a calculator appears to be correct and it is an overflow problem, then you might try playing around with breaking up this statement and use a temporary long variable and first assign one part to the long you have, put the other part into another long and then do the multiply and divide…

If you start walking at about a 45 degree angle is the servo pointing in the right directions?

If this does not help, hopefully Laurant can help you Jim (Robot Dude) contacts them after they reopen on Monday.

Good Luck

so! i think i got it!!! :slight_smile:
i changend manny values in the “H3” and in the 180 Deck Code “”(Dangle < 64 or Dangle > 191)"" but nothing goes to the right effect!!
Then i changed ““DAngle =256 - DAngle”” to “255” and now turns the panning servo right!!! i dont know really why but it works fine!!!

I will let Laurent know your findings. Sorry for the trouble.