Help with Xan's Phoenix Code for CH3-R

Hi Kurt,

Have you tried connecting your CH3-R robot directly to PEP, and do you see the same issues there?

I actually took some video of this, havnt had a chance to upload it yet tho… I will do that tonight… cause there is that, and also when you try to rotate the body using the left stick, the middle legs dont rotate on the horizontal COXA. I’ll upload the videos tonight, should we start a new topic for this?

Hi Kurt (and others),

I’ve studied the numbers you have posted and there are something seriously wrong with the BodyIK outputs.

One question just to be sure. Did you change the sbytetable to swordtable on the coffsetX table?:

;Body Offsets (distance between the center of the body and the center of the coxa) cOffsetX sbyteTable cRROffsetX, cRMOffsetX, cRFOffsetX, cLROffsetX, cLMOffsetX, cLFOffsetX

Hi Zenta,
No I had not changed any of the byte tables. Hopefully in the next few days I will be able to start looking at this again. I have been busy with other unfun non-robotics stuff. My robotics stuff I have been mostly been playing around with Arc32-phoenix (different thread), but added keyboard monitor (since I can easily check if any keyboard stuff has come in on hserial. Integrating in EEPROM dump, servo zero offset finder, Set debug level, and download sequences… ) But again different thread…

Back on topic. Some of the numbers I posted looked strange and did not make sense. That is the LegIK stuff when I was printing out Temp1, Temp2 and Temp1/(temp2/10000). When I was using SDEC it looked better, but they are long values… So need to figure out what the number actually are…

Kurt

That appears to be it!!! :smiley: :smiley: :smiley:
I changed all of the variables in the body Inverse Kinematics to be one size bigger (Use big hammer) :laughing:

;Body Inverse Kinematics BodyRotX1 var slong ;!!!sword ;Global Input pitch of the body BodyRotY1 var slong ;!!!sword ;Global Input rotation of the body BodyRotZ1 var slong ;!!!sword ;Global Input roll of the body PosX var slong ;!!!sword ;Input position of the feet X PosZ var slong ;!!!sword ;Input position of the feet Z PosY var slong ;!!!sword ;Input position of the feet Y RotationY var sword ; !!! SBYTE ;Input for rotation of a single feet for the gait sinA4 var slong; !!!sword ;Sin buffer for BodyRotX calculations cosA4 var slong; !!!sword ;Cos buffer for BodyRotX calculations sinB4 var slong ;!!!sword ;Sin buffer for BodyRotX calculations cosB4 var slong ;!!!sword ;Cos buffer for BodyRotX calculations sinG4 var slong ;!!!sword ;Sin buffer for BodyRotZ calculations cosG4 var slong ;!!!sword ;Cos buffer for BodyRotZ calculations TotalX var slong ;!!!sword ;Total X distance between the center of the body and the feet TotalZ var slong ;!!!sword ;Total Z distance between the center of the body and the feet BodyIKPosX var slong ; !!!sword ;Output Position X of feet with Rotation BodyIKPosY var slong ; !!!sword ;Output Position Y of feet with Rotation BodyIKPosZ var slong ; !!! sword ;Output Position Z of feet with Rotation
And then change the sbytetable to be swordtables (What I did not do before…)

;Body Offsets (distance between the center of the body and the center of the coxa) cOffsetX swordTable cRROffsetX, cRMOffsetX, cRFOffsetX, cLROffsetX, cLMOffsetX, cLFOffsetX ; was sbytetable cOffsetZ swordTable cRROffsetZ, cRMOffsetZ, cRFOffsetZ, cLROffsetZ, cLMOffsetZ, cLFOffsetZ ; was sbytetable
And now all of the legs appear to move the right way!!!

This makes a lot of sense now that I look at it as for example:
cLMOffsetX con 138 ;Distance X from center of the body to the Left Middle coxa
Does not fit very well in to an SBYTE. :blush:

Thanks Zenta!!!
Kurt

You guys are the best!!! 8)

Thanks,
I suppose we should try to put together an update the will work for any others who wish to use the phoenix 2.x code. Mine is currently configured for XBee - Binary communications - SSC-32 at 115200. I did purchase a couple extra PS2 receivers, but I need to take a couple of servo Jumper wires and make a wiring setup for it… So do you think the modified version of the 2.0 code for binary communications would be OK or would it be better to generate a zip file with the original 2.0 code with minimal changes?

Kurt

Quick Update: I think all we need to do is change the two sbytetable to swordtable. I removed the other changes of sizes and I think it is still working fine. Might be simple to do to the current zip files.

My conservative side says lets get the original 2.0 code with the required changes. However my greedy side wants both. lol :smiley: We have discussed in house, on several occasions, there needs to be a tutorial for Xans code that is not robot specific. Or at least for any of the bots we sell. It’s not done because we are still working on assembly guides for T-Hex and the foot sensors. But here pretty soon we will need to do a tutorial for T-hex (3DOF) and that’s where we need to decide. Yet another robot specific tutorial, or a tutorial for Xans code that has enough information for any robot to be set up and configured.

Exactly!

I’m glad its finaly working! :smiley:

I did spend some time today (at work…) thinkering about the numbers and checking it all using PEP. And it all ended up with wrong output from the BodyIK for the middle legs. So since you had allready said that you changed all sbyte to sword I just had to check if the sbytetable still was sbyte… :wink:

Very often bugs like this has a very logic and simple solution. The challenge is to find it though…

Do you get this bug also Kurt?

I think this fixed his problem as well. As I mentioned in my update I think the only change needed was for the tables. I converted all of the variables back to what they werel and it still looks like it is working.

I will now download the current virgin copy from the website, make the change and try it with the PS2… Just finished rigging up making a wiring harness for an extra PS2 receiver. Now need to update the CHR-3 to use it, plus change the jumpers to the SSC-32 to 384000 and see that it works.

Kurt

OK I did the update to a fresh copy of the CHR3-PS2 software that I downloaded today. I updated my chr-3 to work with the PS2 at 38400 and I think it is behaving better. Here is an updated zip file…

Kurt
ch3r2ps2.zip (15.5 KB)

Awesome guys!
I’ll give it a look tonight…

I am still just figuring things out… I need to get more into it because I added a “head” and “neck” to my CH3-R.
I basically added a horizontal neck server, then a vertical neck servo, a couple server erector set brackets, the a vertical head server, and finally a horizontal neck servo. It has a pincher servo for the pincher… going to mount the cmucam3 up there too :wink:

So, Is the head code you used somewhere? or is the head on yours always controlled by the movement of the body?

Check out Mean Green… viewtopic.php?f=20&t=5636&start=0

He will share his code. It could be helpful.

Thanks for the heads up… his weapons platform is almost exactly like my head and neck, pm’d him to get a copy of his code hopefully :smiley:
Thanks!!

I tested this last night… it DID fix the issue with the middle legs not rotating with the body… AWESOME!

Many thanks to Kurt and the others for figuring out the CH3-R rotation problem!!

Best,
KarlElch

Kurt,

It’s missing the zip file!

I understand you’ve made some improvements, great job!

Alan KM6VV

It’s 6 posts up from yours. :wink:

Thanks Zenta for pointing out the existence of this thread!

I’m running into the same problem with my IK code when I tried to migrate it to the CH3-R from the Phoenix.

My suspicions were in the ranging problem, since a minor body rotate with the CH3-R means a much more extreme angle change on the leg joints since the body is a lot longer than the phoenix’s.

When I get home, I’m going to check on all my data types…

Particularly the last TOINT that I’m using to convert the Radians into pulse widths…

-Tom

:slight_smile: :slight_smile:

I have been reading our this thread as i feel i may run into this same problem…
Kurt, great work in getting it to work (you hope) … well we all do! :smiley:
i haven’t managed to test it yet as my rig isn’t set up, but 'has anybody else?