A head for my Hexapod

hey guys,

Can anyone point me towards the code for headmovement? I need it for Xan’s code. If there is such a thing. I’ve been searching for days but can’t seem to find anything…

The best would be to have the code from the A-Pod. That is beautifull!

Thanx in advance

It really depends on your setup…

Have you built the head yet?

Any kind of code that is given will need quite a bit of tweaking to match with your setup

this is for the Pan not tilt. im sure you can add the tilt by changing the Z/X for Y (i think).
Choose you pin connection.

HeadPin con P? ;Head rotation
be sure to get your mech limit correct.

HeadPin_Min con -90 ;Mechanical limits of the head ROTATE HeadPin_Max con 90

HeadAngle       var sword   ;Actual Angle of the head rotate

;in CheckAngles:

HeadAngle = (HeadAngle min HeadPin_MIN) max HeadPin_MAX

;in ServoDriver:

  Serout SSC_OUTPUT,SSC_BAUD,"#",dec HeadPin,"P",dec (HeadAngle+90)*10000/1059+650] 

;in in Main just before the CheckAngles sub.

GOSUB HeadTracking

;add to end of Main

[code]HeadTracking: ;(Head Tracking)

;Return to the middle position
HeadAngle=0

IF (ABS(TravelLengthX)>TravelDeadZone | ABS(TravelLengthZ)>TravelDeadZone | ABS(TravelRotationY*2)>TravelDeadZone) THEN

;Calculate walking direction X and Z
TravelLengthXZ = SQR((TravelLengthX * TravelLengthX) + TravelLengthZ * TravelLengthZ)
HeadAngle = TOINT(FACOS(TOFLOAT(TravelLengthZ) / TOFLOAT(TravelLengthXZ)) * 180.0 / 3.141592)-180

;Add sign depending on the direction of X
HeadAngle = HeadAngle * (TravelLengthX/ABS(TravelLengthX))

ENDIF

;Calculate body angle depending on rotation
IF ABS(TravelRotationY2)>TravelDeadZone & ABS(TravelRotationY3) > ABS(HeadAngle) THEN
HeadAngle = -TravelRotationY3 ; Rotation max = 166 to get max range of 90 deg.
ENDIF

RETURN[/code]

you may need to change your TravelDeadZone as its abit twitchy!
:wink:

oh wow! thanx! i’m going to start programming tonight.

So will this script only move the head when walking? or also with the body movements?

And i want to attach a tail like thingy too. Can i just copy all the script en rename some stuff?

I have no head yet but i wanted to have a 2-DOF. Same for the tail

it will move the head so it faces the walking direction. and also yes 'during body moves.

just cope it into your code at the given places and it should work just fine. any problems just ask.

This is thanks to Xan, who sent this to me awhile back, when i was after the same idea as you.

you can rename what ever you like as long as it corresponds with other sections of the code.

i remember resently reading that Zenta has been having problems getting his A-Pod hexapod to walk correctly due to the excess weight (offsetting the balance) of the head and tail. im guessing you wont be hiding the electronics in the tail or head as he did.

2DOF would work ok i guess. never tried it myself.
anyway good luck with your project.
look forward to seeing it. :wink:

just a thought that you will notice the code will make the servo twitch slightly while following direction, (not off putting but you will notice it) and i beleive its because the code is asking the sservo to return to center
;Return to the middle position
HeadAngle=0
and i beleive its trying to loop this in each time the code is called.
should be fine though. :slight_smile:

Great! I started implementing the code. Can’t yet test it though. I disassembled my bot last night because i want the electronics to be inside.

I will keep you posted!

i think i burned my ssc-32 controller. It won’t power up anymore. no led, no movement.

sorry to hear you are having problems. you’v just jointed my club! :smiling_imp:

is this only on the PS2 or the boards?

does the ABB beep when power on? do the servos twitch?

movement well this answers my first two questions so i would say you only have a power issue. :question:

did you have it running with the current setup before it all went bad?

if not, i would try and see if the polarity is correct for PS2 batterys etc…

are the correct jumpers installed?

They do twitch when put the power in. But the Big transistor on the board get really hot. That is wat i smelled.

It is the ssc-32 that is giving the problem. Not the BBA pro 28

it was working fine. my hexapod was walking. I was calibrating the legs when i smelled something. Now it doesn’t do anything except for the twitching you mensioned.

Here is an overview of the SSC.

I think you’re talking about the part marked with number one. It’s the voltage regulator. It’s supposed to get a little hot when in use but can burn when you put to much amps trough it. The Voltage regulator is supposed to only feed the electronics. No servos. Do you have jumper 5 installed?

How do you power your bot?

Xan

I would also check for shorts. Maybe a servo wire got caught in a servo, or stretched, such that wires got exposed and maybe the pulse wire is shorted out…

Also check your wires for connecting the BB2 to the SSC-32 as well as the power wires…

Try disconnecting all of the servos from the board. Does the SSC-32 power up properly. If so you can try simply adding a few see if it still comes up, until you find the one. You might also be able to use a voltmeter and check to see what the resistence is from the pulse to ground of each of these wires.

Kurt

I think a servo probably was connected backwards and got ruined. happened to me and my regulator got real hot. you were probably smelling the servo burning up.

Brandon C.

indeed i was talking about number one.

I disconnected everything allready and tried to power it but no luck.

I’m sure i didn’t switch any wires. Like i said it was working fine when it stopped. I had all the legs standing and then it collapsed.

too much current? i only have 18 servo’s on there. Nothing else…

I didn’t had the vl=vs jumper installed because i use two different power sources.

servo’s are brand new and the wires are all ok.

Also as a long shot, check to make sure that there is nothing shorting out any of the traces. For example there could be a lose bolt/nut that was floating around in your case, but now rolled under it and shorted out something… (Happened to me).

Kurt

The only way the regulator can get smoking hot is if the output were shorted to ground. Was there any metal parts that could have touched the traces on the board?

What specifically did you have connected to the VL terminal?

Normally this is a 9vdc battery. When using a 9vdc battery if the output of the regulator were to become connected to ground via whatever means, the result would be the 9vdc battery would quickly become depleted, the regulator would go into shutdown but nothing would be permanently damaged. But if you had a 1000mAh or larger pack it could maybe damage the regulator.

Put an ohm meter from ground to the 5vdc line, this can be found by the analog input headers. If it’s 0 ohms that means there is a short somewhere on the 5vdc line.

If you’re lucky the board may still be good, but the regulator itself may be bad. The only way to determine this is to remove the regulator and try to inject 5vdc onto the 5vdc line.

Keep us posted.

As far as regulators going bad, I have never heard of them going bad for no reason. If anyone else has, I’m all ears… To the best of my knowledge something has to short out the output in order for the regulator to burn up.

Bypass caps are not known for going bad in a few weeks of use. There is a tantalum cap on the output. It’s probably the best place to look for a short. If it’s the tantalum, it may be a factory defect?

I have had 2 regulators go bad after connecting an AC power adapter to them accidentally (although I highly doubt that’s what he did). kurt might be right though. a loose bolt might have fallen underneath the board when the robot stood up and could have shorted something. Has the board been removed from the robot since this happened?

Uh this isn’t the regulator “going bad”. This is I screwed up and I blew up my regulator. :wink:

In fact the regulator used on the ssc-32 and abb is pretty tough in that it can handle a short circuit for quite some time before allowing you to kill it. it actually tries to protect itself when it starts to get hot by reducing its output voltage. what it doesn’t handle is “I put too much voltage across it’s input” or “I put reverse voltage across its input” or “I smacked it with a screwdriver and busted a leg off”. Actually all three of those errors are highly likely to take out the tantalum filter capacitors before the regulator gives up the ghost. so reality is if you manage to actually kill the regualtor then you tried pretty hard.

consider please if you put the car in reverse instead of drive as you intended then step on the gas and smash into the garage door or car behind you, do you seriously think it’s the fault of the car? O.o

:laughing:
One of my friends wife did exactly that. And what did she blame… The car of course! :unamused:

What else…? :question: :unamused:
Certainly not the garage! :stuck_out_tongue:

Well if the garage had not been there…