T-Hex, a Mech inspired 6x4 DOF hexapod

Merry Christmas to you as well.

Yep by default XBee work in a terminal replacement mode. You have to use special ways to get into a command mode where you set the destination you wish to talk to…

In API mode you compose packets of data, where you set the destination in the packet as well as some other information like size of the data and a checksum. So in my pre-api mode, I was creating my own packets with sizes and checksums and the like, which than the XBEE wrapped up in it’s own packets and sent it to the other side that unwrapped the XBEE packet and gave me a stream of data. I then had to do the work to verify I got the proper start of a packet and extract the data…

Also I nice point with API mode is I can have the robot set up for multiple destinations. One to talk to the remote and another to send to the PC for debug information…

Hi Kurt,

I’ve just tested the code and it compiled and worked just fine!

Thanks!

Thanks Zenta! Now sometime I will need to setup a hex with multiple types of legs and see what happens :laughing:

Kurt

Hi,

Here is my latest update on the T-Hex and Phoenix code. They share all the files but different .cfg files. I did try to use the ServoDriverStart and ServoDriverCommit like Kurt did, not sure if I got it 100% correct. (Kurt, would you mind to take a look?) The code work fine for XBee (API) though, didn’t test it using PS2 but I think that should work fine.

Thanks to Xan and Kurt!
Phoenix and T_Hex_PS2_XBee_API.zip (55.6 KB)

Hi Zenta,

I took a quick look through and it looks good to me, I also tried compiling for both Bap28 and Arc32 and that works. Have not tried running it yet, may try later with the phoenix with Arc32…

Kurt

Hi Kurt,

I thought your Phoenix was powered by ARC-32 only or do you use the ARC+SSC combo on Phoenix?

My phoenix is powered by only an Arc32. My CHR-3 is sort-of a chameleon , it always has an SSC-32. As I play around I change what is sending the signals to the SSC-32. Currently it is using an Arc32. It originally had a Bap28, it has also had a propeller and it has had an Arduino Mega. I may soon put the Mega back on it as there was some issues with the code running with the latest Arduino IDE…

I guess a real question is, should I re-merge back in some of the other changes I made to the previous set of T-Hex code I posted, that had two versions of the ServoDriver. One that uses an SSC-32 and a second that outputs HSERVO commands… I did run that version on my actual phoenix…

Kurt

I’m not sure if I follow you, did you post a code that supported both HSERVO commands and SSC-32? I must have missed that :unamused: , where did you post it? I do like your ARC-32 version, especially the “extra” stuff with the servo offset feature, did you merge that to?

BTW, all my robots are now working with the XBee API code. Archer uses a hacked version of your ARC-32 phoenix code. I kept running out of memory space for A-pod so I had to remove some parts. Actually I’ve been thinking of replacing the two (BB2+SSC-32) boards with ARC-32 on A-Pod for two reasons: Saving weight and more memory space.

Hi Zenta,

I believe I posted the code in your archer thread on about Dec 24th: viewtopic.php?t=6342&p=68064#p68064

This is the full phoenix with Arc32 code base with all of the extras, plus it had multiple configuration options including the option to use an SSC-32…

Kurt

:laughing:
Awesome Kurt, I totally missed that one. :blush: It’s getting messy with all the different code versions, I wish there was a better system for organizing the different versions on the forum. Maybe a thread just for code updates or something? Not spread all over many different threads.

Another thing I’ve been thinking on: With all the #ifdef’s in the code, I wish that the Studio IDE had a better way to display what part of the code that was active under compiling. Maybe the non-active code could be grayed out? Is that possible? Just a thought…

I know what you mean, that is why I started playing with merging versions which is why I made the version I mentioned in the previous post. Hopefully I will get inspired and merge that also with the THex stuff for 4dof/3dof and mixed…

We almost need something like a sourceforge or other source control system to keeping the different versions… Or maybe something like the Propeller Object Exchange… Something like this would be good also to handle issues like finding updates to programs that are mentioned in different tutorials, that need to be updated due to changes in the IDE or the like…

Yep, that would be nice. At times the variables mentioned in the ifdef will be color coded showing if it is defined or not, but I find when it goes to multiple files or if the define is defined within an ifdef that accurate, especially in multi-file projects… Maybe Nathan could do something…

Kurt

That would be very helpful for making sure that you work with the latest version without any known bugs. Like I just did on Archer, sigh… :unamused:

I mentioned this in your wishlist thread in the BM forum.

Just jumping in here to say, I’m looking into this. I can’t make any promises, but a system like you’re suggesting would make a lot of things convenient. I’ll let you know when I have some definite information.

Sounds great Beth! :smiley:
Thanks for taking a look into it, many people would find that very useful.

Hi Kurt and others,

Yesterday I had a robotic course and demonstration at two local libraries. Everything went well except for one thing that I had forgot to test. :blush:

The GP player didn’t work on Phoenix.

I’ve done some debugging. My SSC32 works fine from Visual SEQ, all GP sequences run fine. The first thing I noticed is that the DIY remote displayed the message: “Seq Disabled” which mean that the GPEnable=0.

[code]GetSSCVersion:
serin cSSC_IN, cSSC_BAUD, 1000, timeout, [GPVerData(Index)]
Index = (Index+1)//3 ; shift last 3 chars in data
goto GetSSCVersion

timeout:
if (GPVerData(0) + GPVerData(1) + GPVerData(2)) = 164 then ; Check if the last 3 chars are G(71) P(80) cr(13)
GPEnable = 1
else
sound cSound, [40\5000,40\5000]
endif[/code]
For some reason all the GPverData (0-2) return 0.?
I’m using GP firmware of course. I’ve also updated the firmware.
I did also try to set the GPEnable to 1 just for a temporary override but the sequences won’t run.

Have you tested the GP part on your code lately, Kurt?

I will take a look. This was actually some of the original code. The only thing I did was add some additional stuff into the DIY to check the state. In addition I added code to verify a sequence exists (location on SSC-32 EEPROM not equal to 0000 or FFFF) and not try to run …

Kurt

My guess is that it could be a timeout issue…

As I suspected, the timeout for reading in the SSC version is too short. It is only 500us, which is timing out… I tried in test program as my phoenix and CHR-3 currently both have Arc32’s on them. My phoenix has no SSC-32 and does it’s own emulation…

When I cut and pasted the code from current phoenix code, which matched yours, it was timing out. When I changed the serin to be:

serin cSSC_IN, cSSC_BAUD, 200000, TO_GPWAIT, [GPStatSeq, GPStatFromStep, GPStatToStep, GPStatTime]
Then it worked and said I had a GP player. Tried with 2.0.4GP and later with the 2.05 EGP…

Not sure why if you hard coded GPEnable=1 why running a sequence did not work. I only had 1 sequence on the SSC-32 sitting on my desk and it appeared like it would run the sequence (I only have 1 servo just plugged into it…) The GPPlayer code in the earlier had no timeout on the serin. The latest code I saw from your T-Hex project had a timeout, but it was rather large:

GPWait: pause 100 disable TIMERINT serout cSSC_OUT, cSSC_BAUD, "QPL0", 13] serin cSSC_IN, cSSC_BAUD, 200000, TO_GPWAIT, [GPStatSeq, GPStatFromStep, GPStatToStep, GPStatTime]
The wait is .1 seconds which should be large enough. If you still have problems, try maybe 500000 (.25 seconds?)
I did not try with XBee plugged in or the like, but it looks like the version I have from you, was correct in it told the controller to disable and it disabled the timer, so the serout to start the command should go out fine… If you still have problems, you may want to hook up the logic analyzer and verify what it is going in and out of the SSC-32.

Kurt

Thanks for your fast reply Kurt! If I get time for it today I’ll try to increase the timeout when reading the SSC ver. I’m still puzzled why the GP wouldn’t play when hard coding the GPEnable=1.

I’ll let you know when I’ve done some more work on this.

Thanks!

Hi Kurt,

Like you said the first ver part was an easy fix. Increased the timeout from 1000 to 2000 and it worked fine.

serin cSSC_IN, cSSC_BAUD, 2000, timeout, [GPVerData(Index)]

But the sequences won’t play. Immediately after commanding a sequence the next message I get on the DIY LCD is “Completed”. I did try to increase the timeout like you suggested but no difference. Looks like I need to do some more thorough debugging with the analyzer then… I have a feeling that the SSC don’t get the “start sequence” command correctly. :confused:

Hi,

Hooked up the analyzer. The sequencer check in (EER-) command seem correct:

But the PL0SQ1ONCE command doesn’t seem correct:

The next QPL0 check looks correct though:

For me it looks like serout cSSC_OUT, cSSC_BAUD, "PL0SQ", dec GPSeq, "ONCE", 13] ;Start sequence get kinda corrupted?

Any idea whats causing this? I might try a lower SSCBaud just for testing.