Ground Contact Switch "Next steps"

Regarding the “Aluminum Ground Contact Switch assembly”

do you have any further images/diagrams/illustrations of one connected to the ABB or SSC?
how about functioning code. so far i have pulled together this.
**Note: code is for a quad running phoenix2.0 **

[code];[Terain adaption]
RF_FSR var bit
RR_FSR var bit
LF_FSR var bit
LR_FSR var bit

prev_RF_FSR var bit
prev_RR_FSR var bit
prev_LF_FSR var bit
prev_LR_FSR var bit

RF_FSR_PosY var sword
RR_FSR_PosY var sword
LF_FSR_PosY var sword
LR_FSR_PosY var sword

FSROn var bit[/code]

[IN MAIN]

[code];Terrain adaption
IF FSROn THEN
gosub ReadFSR
ELSE
RF_FSR_PosY=0
RR_FSR_PosY=0
LF_FSR_PosY=0
LR_FSR_PosY=0
ENDIF

;Balance calculations
TotalTransX = 0 'reset values used for calculation of balance
TotalTransZ = 0
TotalTransY = 0
TotalXBal = 0
TotalYBal = 0
TotalZBal = 0
IF (BalanceMode>0) THEN
gosub BalCalcOneLeg -RFPosX+RFGaitPosX, RFPosZ+RFGaitPosZ, (RFPosY-cRFPosY)+RFGaitPosY+RF_FSR_PosY, RFOffsetX, RFOffsetZ]
gosub BalCalcOneLeg -RRPosX+RRGaitPosX, RRPosZ+RRGaitPosZ, (RRPosY-cRRPosY)+RRGaitPosY+RR_FSR_PosY, RROffsetX, RROffsetZ]
gosub BalCalcOneLeg [LFPosX+LFGaitPosX, LFPosZ+LFGaitPosZ, (LFPosY-cLFPosY)+LFGaitPosY+LF_FSR_PosY, LFOffsetX, LFOffsetZ]
gosub BalCalcOneLeg [LRPosX+LRGaitPosX, LRPosZ+LRGaitPosZ, (LRPosY-cLRPosY)+LRGaitPosY+LR_FSR_PosY, LROffsetX, LROffsetZ]
gosub BalanceBody
ENDIF[/code]

[AFER FREE SERVOS]

[code];[ReadFSR] Reading input from Tars pressure sensors
ReadFSR:
input P0
input P1
input P2
input P3

prev_RF_FSR = RF_FSR
prev_RR_FSR = RR_FSR
prev_LF_FSR = LF_FSR
prev_LR_FSR = LR_FSR

RF_FSR = IN0
RR_FSR = IN1
LF_FSR = IN2
LR_FSR = IN3

IF RF_FSR=0 THEN
RF_FSR_PosY = (RF_FSR_PosY+1)max 60
ENDIF

IF RR_FSR=0 THEN
RR_FSR_PosY = (RR_FSR_PosY+1)max 60
ENDIF

IF LF_FSR=0 THEN
LF_FSR_PosY = (LF_FSR_PosY+1)max 60
ENDIF

IF LR_FSR=0 THEN
LR_FSR_PosY = (LR_FSR_PosY+1)max 60
ENDIF

IF (RF_FSR+RR_FSR+LF_FSR+LR_FSR)>=6 THEN
RF_FSR_PosY = (RF_FSR_PosY-1)min 0
RR_FSR_PosY = (RR_FSR_PosY-1)min 0
LF_FSR_PosY = (LF_FSR_PosY-1)min 0
LR_FSR_PosY = (LR_FSR_PosY-1)min 0
ENDIF

;serout s_out, i57600, [sdec RF_FSR_PosY, 13]

return[/code]

We still need to make a schematic illustrating the pullups. Sorry it’s not done yet. No I’m not aware of any foot sensor code. :frowning:

no worries, well i should be ordering them soon so ill run some test and hopefully have a good video.
its for the T-hex quad, AXIS.

Yep, I keep meaning to order some stuff to play with this, but have not gotten around to it yet. Will be interesting to see the different options on what to do when it detects something.

Kurt

We know and expect the obvious with using terrain adaption:
The chosen leg rises and falls in till it detects surface, then next leg is selected to rise.

My idea is to write the code so that the leg rises and then falls to the floor as normal but once it gets to the “Out_of_Reach” value (no surface detected) it will then rise again and replace its trajectory in another location in till it finds the floor. kinda like if you made it walk over a drain.
http://t1.gstatic.com/images?q=tbn:tr5hpsUn2iHJHM:http://www.elated.com/res/Image/imagekits/142/drain-cover.jpg&t=1

i think that might be quite interesting to watch. :wink:

Yep, sounds like it would be interesting to watch.

There are several different levels of things that would be fun to test out. Including first off how to process the detection. If with SSC-32, do you ask the SSC-32 to stop quickly and ask for it’s location or do you ask it to do really small increments, or maybe you can tell it to try the full normal step and when there is a detection, try to use the timing information to interpolate where we think the SSC-32 should be and then tell the SSC-32 to be there…

Then there are all levels of things like you mention plus many others.

  1. If one leg steps on something, do as you mention and have it walk over it.
  2. New one you mention. One leg starts to fall into hole…
  3. Two front legs are stepping onto something… Do you
  4. Two legs on the same side step onto something… case 1) The other front leg is not on something. case 2) other front leg is on something as well…
  5. What happens when you start going up an incline

    Lots of things to try out.

Kurt

That is a great walking gait!!!

Great job!!

Thanks Mike.
Be great to see what can be done with the Contact Switch… :smiling_imp:

here is the contact switch being used for v1.3. you can see it has the ##_FSR_PosY function added.

;Balance calculations TotalTransX = 0 'reset values used for calculation of balance TotalTransZ = 0 TotalTransY = 0 TotalXBal = 0 TotalYBal = 0 TotalZBal = 0 IF (BalanceMode>0) THEN gosub BalCalcOneLeg -RFPosX+RFGaitPosX, RFPosZ+RFGaitPosZ, (RFPosY-cRFPosY)+RFGaitPosY+RF_FSR_PosY, RFOffsetX, RFOffsetZ] gosub BalCalcOneLeg -RRPosX+RRGaitPosX, RRPosZ+RRGaitPosZ, (RRPosY-cRRPosY)+RRGaitPosY+RR_FSR_PosY, RROffsetX, RROffsetZ] gosub BalCalcOneLeg [LFPosX+LFGaitPosX, LFPosZ+LFGaitPosZ, (LFPosY-cLFPosY)+LFGaitPosY+LF_FSR_PosY, LFOffsetX, LFOffsetZ] gosub BalCalcOneLeg [LRPosX+LRGaitPosX, LRPosZ+LRGaitPosZ, (LRPosY-cLRPosY)+LRGaitPosY+LR_FSR_PosY, LROffsetX, LROffsetZ] gosub BalanceBody ENDIF

Here is the Balance cal for V2.0.
Q: How should i add the ##_FSR_PosY fucntion to this:

[code] ;Balance calculations
TotalTransX = 0 'reset values used for calculation of balance
TotalTransZ = 0
TotalTransY = 0
TotalXBal = 0
TotalYBal = 0
TotalZBal = 0
IF (BalanceMode>0) THEN
for LegIndex = 0 to 2 ; balance calculations for all Right legs
gosub BalCalcOneLeg -LegPosX(LegIndex)+GaitPosX(LegIndex), |
LegPosZ(LegIndex)+GaitPosZ(LegIndex), |
(LegPosY(LegIndex)-cInitPosY(LegIndex))+GaitPosY(LegIndex), |
LegIndex]
next

for LegIndex = 3 to 5	; balance calculations for all Left legs
  gosub BalCalcOneLeg [LegPosX(LegIndex)+GaitPosX(LegIndex), |
						LegPosZ(LegIndex)+GaitPosZ(LegIndex), |
						(LegPosY(LegIndex)-cInitPosY(LegIndex))+GaitPosY(LegIndex), |
						LegIndex]
next
gosub BalanceBody[/code]

This is what im thinking. would this work? obviously ill confirm most of this once iv got my contact sensors.

cFSR        sbyteTable RR_FSR_PosY, RF_FSR_PosY, LR_FSR_PosY, LF_FSR_PosY

[code] ;Balance calculations
TotalTransX = 0 'reset values used for calculation of balance
TotalTransZ = 0
TotalTransY = 0
TotalXBal = 0
TotalYBal = 0
TotalZBal = 0
IF (BalanceMode>0) THEN
for LegIndex = 0 to 2 ; balance calculations for all Right legs
gosub BalCalcOneLeg -LegPosX(LegIndex)+GaitPosX(LegIndex), |
LegPosZ(LegIndex)+GaitPosZ(LegIndex), |
(LegPosY(LegIndex)-cInitPosY(LegIndex))+GaitPosY+cFSR(LegIndex), |
LegIndex]
next

for LegIndex = 3 to 5	; balance calculations for all Left legs
  gosub BalCalcOneLeg [LegPosX(LegIndex)+GaitPosX(LegIndex), |
						LegPosZ(LegIndex)+GaitPosZ(LegIndex), |
						(LegPosY(LegIndex)-cInitPosY(LegIndex))+GaitPosY+cFSR(LegIndex), |
						LegIndex]
next
gosub BalanceBody[/code]

… also, iv been thinking about ways to interface the contact switch to a I/O pin. instead of soldering to the board we could just connect it direct from the sensor, could we not?

sorry for my picture. :laughing:
http://i531.photobucket.com/albums/dd355/innerbreed/10kpu.jpg
not much of a programmer nor electrics.

I think you meant connect it direct using a cable? But anyway, yes this is how I have wired it for testing.

yes. well i have ordered my switches from Active and ill get some resistors ready for my project. :wink: 10k?

10kΩ would be perfect.

I have wired up my legs from the AX0,1,2,3 pins off the Botboard and waiting for the contact switches to arrive.
“well im waiting for Active to email me when they arrive in store”.

My resistors are coming tomorrow also so things are moving. :slight_smile:

At the moment its sitting with wires protruding from it’s tars. :open_mouth:
I have been working on the code this evening, and im happy with it so far, but as i cant test it properly its getting frustrating.

getting quite excited and im very curious as to what will happen once the switches have been added.

Keep you posted. :wink:

If you want to get started testing, you can do it with aluminum foil, 4 resistors of fairly high resistance, and some connection wire. Glue sheets of aluminum foil on a piece of cardboard or poster paper big enough for the bot to stand on. Twist some aluminum foil booties on the bot feet. Connect one end of the resistors together and connect to 5v. connect the other end of each resistor to the analog input to be used. connect a wire from each aluminum bootie to the analog input side of the resistor. Connect the aluminum foil pad via a wire to the board ground. With the aluminum foil bootie touching the aluminum pad, the analog input will be 0v, and when the bootie is not touching the pad, the analog input will be 5v.

Yes iv seen this done. i think ill wait for the switches though. :wink:

Here is how iv hooked this up. some how i feel iv done something wrong. is that correct?
http://i531.photobucket.com/albums/dd355/innerbreed/FSRconnection.jpg

When I did my testing I connected the resistor between the 5v and the I/O pin, one end of the contact switch to ground, and the other switch wire to the I/O pin. In your circuit, it looks like you may short the the board 5v directly to ground when the switch is closed. In your wiring I would connect the black wire to the I/O pin along with the resistor. This way the resistor keeps the I/O pin at 5v until the switch is closed. When the switch is closed the I/O pin is grounded and the resistor with a high value is also shorted to ground and not able to keep the I/O pin high. In your setup, I’d solder the black wire to one side of the resistor lead, and stick this lead in the I/O pin hole, and stick the other resistor lead in the 5v pin hole. Keep the yellow wire where it is.

If it were me, I would plug the Black wire into ground on the BB2. I would plug the Yellow into the signal pin. and I would plug the resistor into +5v and signal.

That way outside of leg is not always hot and besides I prefer black for ground… And as Zoomcat mentioned your current diagram will be dead short when the switch is closed.

Kurt

P.S - My stuff should arrive probably mid next week.