PS2 Control of A-POD

Jim and others,

I was giving some quick thinking about some quick and dirty way to control the new functionality of the A-POD. I hate the idea that if the hardware and tutorials are reasonably ready, that there won’t be A-pods out there scaring kids and chasing cats and dogs around the Christmas Tree :laughing: I don’t think we can do anything this short term to make use of the contact switches, but if at a minimum the users can control the tail and head, I personally think it will be worthwhile. Later if the user needs to update some electronics to do full blown TA, well, we can cross that bridge. But as I mentioned I do think we should be able to get some TA to work with BAP28…

Now back to PS2: My quick thoughts are:

  1. Remap some of the current functionality that is on some of the L1/L2 and/or R1/R2 to something else. For example map R1 and R2 to L3 and R3. Note: current code has R3 mapped to different walk modes. Could double up here. Where it does both Walk mode and lets say Double speed (4 clicks to cycle).

  2. Use the 2 freed up buttons as modifiers. Could be something like:
    Holding R1 down: moving Left joystick moves 2 head servos and moving right joy stick moves mandibles.
    Holding R2 down: moving Right (or left) joystick moves the 2 tail servos.

Again this does nothing about TA, also does no fancy things like maybe move tail in opposite direction of where body is moving in gait… But may be enough for people to have fun experimenting with it until more advanced features come on line. If time permits one could also add in support for the contacts in the mandibles. Don’t have either hardware or the prototype software to experiment doing this. But if you have the DIY version there and an A-Pod built, I could easily try hacking up the PS2 code and let you try it out.

Just a thought
Kurt

Funny, I’ve been thinking of posting a similar thread.

Making A-Pod work with PS-2 is on my next To-Do-List.
I’m just wondering what Phoenix code version I should work on for the PS-2 support?

Since I don’t have the LM A-Pod version either I need to connect the PS2 receiver to my A-Pod. I’m not using the servo offsets in the SSC-32 on my A-Pod so i need to cheat a little but that shouldn’t be a trouble.

Btw, did James or Jim try the phoenix code on their A-Pod just to see if it walk ok?

I’ve not done much thought about how to control it using the PS2 commands, I’ll look into Kurt’s suggestions. But I do like having the ability to switch between “head tracking”, “fixed head” and “head only” control. That could be done with a simple toggle function. The abdomen (tail) doesn’t have any direct control, its determined by the rear legs position, body height and rotation (if I recall correctly).

But when it comes to the foot switches, I’m not sure either. BAP28 don’t have enough code space for TA and A-Pod control. Its a good thing that the Lynxmotion version has much more space for an optional controller board though.

Great, I will give all of the suggestions I can as I would love to see it up and going!

If possible I would start with the 2.1 code that is pretty well released. If you have a version of the 2.0x with your support in it, I will be glad to help merge…

Yes it would be great if we knew that the current Phoenix code like the T-Hex with PS2 support worked, with modifications for the body and leg differences.

I was not sure how much code support you had in your current one. But could easily do things like:
Press R1 and move Joysticks while R1 is down does what I mentioned. Press and release R1 and release toggles between the other modes… Or some such thing. And if as you said the tail code did not have any independent movement, could either use R2 to do some more mode switching, or potentially only have to move one buttons code. Like R1->L3…

As for TA. As I mentioned in the other thread, by disabling GP code I was able to get Xan’s code to compile with 10 whole bytes to spare. My earlier checks showed that the PS2 version is about 5K smaller, so again I think once we have TA working, we will be able to have a decent PS2 version that “Dances like a Ballerina” but may not be able to do some other things with the same build…

Kurt

Hi Guys,

Good idea, I think Jim will be very pleased to get his LM A-Pod walking!

The best software to start with is 2.1 indeed. The only thing I want is an updated header for the DIY remote before it’s ready for release.

I can also give you some heads up on the A-Pod TA part. Last week Jim and I had a chat about this. Since TA is holding up the release of A-Pod he decided to design some tibia parts without sensors. A-Pod will be released without TA. TA could be an upgrade kit in a later stadium.

Xan

We haven’t tried it yet, no. The A-Pod we have here has the mandibles and abdomen on and I can’t bring myself to take them off just to test the walking. Should modify the code just to keep those servos steady, but I haven’t gotten around to it yet. :blush:

Hi Guys!

This is really great news. The foot switches and lack of support is not the only thing holding up A-Pod though. We need to get it walking (as Kåre mentioned) and we still have some major kit packing to do. James will be working on getting it walking this week. We would be happy to test any code that comes our way. :slight_smile: I may take a different route on the legs. We can leave out the switches and cables, and just tighten the hardware down to lock the leg. If ground contact switches were desired they only need to purchase the switches. The price difference on the PVC parts of a non switch tibia would be negligible. This would be the easiest way, and it really makes sense. :slight_smile:

Zenta, James and Jim,

Do you have a version of the XBee controlled A-Pod that you can post to me. I will be glad to take a quick pass through and try to merge in the 2.1 stuff and any other changes needed. Also could take a quick pass through the pS2 code to see if I can come up with a version to try. Obviously Zenta if you have the time, it would be great as you can try running it on your robot… I may be able to cobble up some hardware to at least verify that I am getting servos to move… Example would be to hook up to end of my ARM which is attached to a block of wood. Could hook up the end servos to allow to close, rotate and move…

James, don’t know which pins are hooked up to the different new servos… Would help to know and I could add some simple Robot Start/Robot Stop code that moves the servos to 0 (1500) and disable…

Got to go…

Kurt

Hi,

Yesterday evening I connected the PS-2 receiver to my A-Pod. Its a good thing I didn’t need to remove the XBee module :smiley: . Sadly I didn’t get much time for it since our little 1 year boy wouldn’t sleep and my wife got the flu… sigh :unamused: And then I got a phone from The discovery channel about my MorpHex… But soon as I get free time for it I’ll get it walking with PS-2.

@James: you don’t have to remove the head and abdomen for testing, you could simply place it on a stand to see if the legs seem to move correctly. Did you get time for calibration of the servos? At the moment I can’t exactly remember how I calibrated the mandible servos. If I recall correctly I calibrated them in the closed position for making sure they meet at the same position when they are closed. I’ve to check more around that since I’m using codeoffsets and other unorthodox methods… :laughing:

@Kurt: I’ll check to see if I can get the 2.1 to work.

  1. COOL! 8)

Oh, so you did read that line… :wink: :laughing:

Just 6 min after you posted!

Oh, as I remember, I skipped the rest of the post and directly hit the quote button. I will finish reading the whole post. LOL

Very cool Kåre! 8)

That is great news.

Kurt

The code was posted over here :smiley:
viewtopic.php?f=20&t=4642&start=180#p77132

[code] cHeadRotPin con P13 ;Head Rotate
cHeadPanPin con P12 ;Head Panorate (side to side)
cHeadTiltPin con P14 ;Head Tilt (up and down)

cMandRightPin    con P28;Right Mandible
cMandLeftPin    con P29;Left Mandible

cAbdomPanPin   con P30;Abdomen Panorate (tail side to side)
cAbdomTiltPin    con P31;Abdomen Tilt (tail up and down)   [/code]

Ok, I started to merge Zenta’s changes into the 2.1 code base. I think I have most of the main code in place… There were some merge issues, like some IK Body offsets not used in the 2.1 so removed from the calls for … Also reused variable in driver that is only there in 4DOF, so changed…

Have not changed anything yet in the PS2 code… But I think I have most of the config stuff in place. May be fun to try it and see if the tail moves…

May have to be careful, may need some init stuff in the PS2 support. Will look at later today.

Kurt
APod_PS2.zip (23.3 KB)

Thanks Kurt I’ll also look into it as soon as I can!

Hi Kurt,

Doing some testings here.

Your legs are differently configured than mine.
Yours:

[code];[SSC PIN NUMBERS]
cRFCoxaPin con P0 ;Rear Right leg Hip Horizontal
cRFFemurPin con P1 ;Rear Right leg Hip Vertical
cRFTibiaPin con P2 ;Rear Right leg Knee
cRFTarsPin con P3 ;Rear Right leg foot

cRMCoxaPin con P4 ;Middle Right leg Hip Horizontal
cRMFemurPin con P5 ;Middle Right leg Hip Vertical
cRMTibiaPin con P6 ;Middle Right leg Knee
cRMTarsPin con P7 ;Middle Right leg foot

cRRCoxaPin con P8 ;Front Right leg Hip Horizontal
cRRFemurPin con P9 ;Front Right leg Hip Vertical
cRRTibiaPin con P10 ;Front Right leg Knee
cRRTarsPin con P11 ;Front Right leg foot

cLFCoxaPin con P16 ;Rear Left leg Hip Horizontal
cLFFemurPin con P17 ;Rear Left leg Hip Vertical
cLFTibiaPin con P18 ;Rear Left leg Knee
cLFTarsPin con P19 ;Rear Left leg foot

cLMCoxaPin con P20 ;Middle Left leg Hip Horizontal
cLMFemurPin con P21 ;Middle Left leg Hip Vertical
cLMTibiaPin con P22 ;Middle Left leg Knee
cLMTarsPin con P23 ;Middle Left leg foot

cLRCoxaPin con P24 ;Front Left leg Hip Horizontal
cLRFemurPin con P25 ;Front Left leg Hip Vertical
cLRTibiaPin con P26 ;Front Left leg Knee
cLRTarsPin con P27 ;Front Left leg foot

cHeadRotPin con P13 ;Head Rotate
cHeadPanPin con P12 ;Head Panorate (side to side)
cHeadTiltPin con P14 ;Head Tilt (up and down)

cMandRightPin con P28;Right Mandible
cMandLeftPin con P29;Left Mandible

cAbdomPanPin con P30;Abdomen Panorate (tail side to side)
cAbdomTiltPin con P31;Abdomen Tilt (tail up and down)[/code]

My A-Pod:

[code];[SSC PIN NUMBERS]
cRRCoxaPin con P0 ;Rear Right leg Hip Horizontal
cRRFemurPin con P1 ;Rear Right leg Hip Vertical
cRRTibiaPin con P2 ;Rear Right leg Knee

cRMCoxaPin con P4 ;Middle Right leg Hip Horizontal
cRMFemurPin con P5 ;Middle Right leg Hip Vertical
cRMTibiaPin con P6 ;Middle Right leg Knee

cRFCoxaPin con P8 ;Front Right leg Hip Horizontal
cRFFemurPin con P9 ;Front Right leg Hip Vertical
cRFTibiaPin con P10 ;Front Right leg Knee

cLRCoxaPin con P16 ;Rear Left leg Hip Horizontal
cLRFemurPin con P17 ;Rear Left leg Hip Vertical
cLRTibiaPin con P18 ;Rear Left leg Knee

cLMCoxaPin con P20 ;Middle Left leg Hip Horizontal
cLMFemurPin con P21 ;Middle Left leg Hip Vertical
cLMTibiaPin con P22 ;Middle Left leg Knee

cLFCoxaPin con P24 ;Front Left leg Hip Horizontal
cLFFemurPin con P25 ;Front Left leg Hip Vertical
cLFTibiaPin con P26 ;Front Left leg Knee

cHeadRotPin con P13 ;Head Rotate
cHeadPanPin con P12 ;Head Panorate (side to side)
cHeadTiltPin con P14 ;Head Tilt (up and down)

cMandRightPin con P28;Right Mandible
cMandLeftPin con P29;Left Mandible

cAbdomPanPin con P30;Abdomen Panorate (tail side to side)
cAbdomTiltPin con P31;Abdomen Tilt (tail up and down) [/code]

Didn’t get much time for testing. I need to do something to the head and abdomen servos since they totally jam the legs :laughing: But PS2 connection worked and the legs could be moved up/down. Can’t do more testings before I’ve fixed the head/abdomen control first.

I only got 30 minutes today and now its getting late…

Thanks Kurt.

Thanks for try Zenta, I used the Phoenix Pin numbers…

Jim/James: Have you wired yours up? If so did you use the same servo numbers as Zenta or did you wire it up like the phoenix. Obviously it is easy in the code to go either way.

Was there any abdomen support in the XBee code or was that all of the automatic stuff that I think I ported over. I put some in Core and the other into the SSC-32. If I am going to do any testing of this, I probably need to update my TH4-r with a Bap again, (currently has UNO32 on it). Alternatively could use T-Hex now with Arc32… and try it there… could probably just mock up the back end to see if the servos move …

Kurt

P.S. - If I get a chance tonight I might take a beginning pass at the PS2 stuff to at least come up with ways to get to the different modes.

Jim - Would you like to keep this type of updates here in the DEV forum or would you like it out in the main forum to get people to see progress.

Hi Kurt,

I found the reason for why the abdomen and head jammed the legs. Replace this part in the driver_SSC file:

[code]#ifdef ApodCode

for LegIndex = 0 to 4 'Just use the TarsPWM as temp value!!
	CoxaPWM = (HeadAbdomenAngle1(LegIndex) +900)*1000/cPwmDiv+cPFConst;1059 +cHeadAbdomenOffset(LegIndex)
	disable TIMERINT
	serout cSSC_OUT, cSSC_BAUD, [0x80+cHeadAbdomenPin(LegIndex),CoxaPWM.highbyte, CoxaPWM.lowbyte]
	enable TIMERINT
next
  	
disable TIMERINT
serout cSSC_OUT, cSSC_BAUD, [0x80+cMandRightPin ,MandRightPWM.highbyte,MandRightPWM.lowbyte,|
							0x80+cMandLeftPin ,MandLeftPWM.highbyte,MandLeftPWM.lowbyte]
enable TIMERINT 

#endif 'Apodcode[/code]

The cPFConst was missing.

But there are still some issues with the abdomen, it doesn’t perform like it should so I’m doing some more debugging around it.

Hi again Kurt,

Ok, the abdomen works fine now. This was the fix in the core file:

#ifdef ApodCode IF LegIndex = cLR THEN LR_RealPosY = (LegPosY(LegIndex)+BodyPosY-BodyFKPosY+GaitPosY(LegIndex)) LR_RealPosX = (LegPosX(LegIndex)+BodyPosX-BodyFKPosX+GaitPosX(LegIndex)) ENDIF #endif

The BodyFKPosXX variables was missing. Probably because of the BodyIK -> BodyFK rename. :wink:


This was the easy part, now comes the harder head part…

Since this is a closed section of the forum, I just have to say it: The PS2 remote real suck big time, its pretty terrible to control A-Pod like it should. Instead of smooth movement it looks like it have some sort of spastic disease. :angry:

EDIT:
Sorry about my little frustration about the PS2. I took a little break and then I suddenly remembered that Jim had sent me two PS2 remotes awhile ago… I tried the other one and it performed a little better! :slight_smile: