DIY Remote Control XBee controller for Robotics

This sounds like the good news! Well done, looking forward to test it out one day.

Ah! I hate that smell too. I did also lost two servos before christmas.

Oops! :open_mouth: Did you made the CHR-3 walk with ā€œmyā€ phoenix code and cfg? Iā€™m so sorry Kurt :blush: , but I forgot to tell you that Iā€™m not using the register offset on the SSC32. My code compensate for the offset with an offset value stored in the cfg file. That might be the reason for why your servos got overloaded. Iā€™ve choosed not to use the SSC register offset mainly because its limited to only +/-100. That wouldnā€™t be a problem for Phoenix though, but for Felix and T-Hex Iā€™m using much larger offset for some servos (up to around 3-400). I donā€™t know if the ARC-32 has any offset registry either? (Another reason for why the offset should be inside the code.?)

Iā€™ve said this before. Since the ā€œdiy transmitter xbee.basā€ file works fine on the DIY there must be something in the new project code that make the timeout happend.? The hardware seem to work very fine. Its just to bad you canā€™t replicate the bug. Iā€™ve no idea what it isā€¦ :confused:

Hi Zenta, I tried making some changes to current version of the tranmitter code to make it closer to the old. That is it now checks to see if there is any avaliable input on hserial and if so it reads with a longer timeout. Also found some issues with checking some variable in a timeout that was more valid when using the taserial support. So could you try this version of the file and let me know if you get better results:

Hi Kurt,

Iā€™ve tested it, but still I canā€™t get any connection to Phoenix.
Do you have any tip if there are any variables/contants I can try other values for regarding the timeout?
Iā€™ve also tried other XBee modules but still the same frustrating result. But I just canā€™t understand why it work with one code and not the other one though.

Thanks for trying helping me out here.

EDIT:
I changed the XBeeā€™s PAN ID and Channel to other values but that didnā€™t do the magic either, just FYI.

:open_mouth: :imp: An expletive would be appropriate at this point:

If you run the test program, do you get any results that look like:

******** XBee Test Program ******** MY: 30 SH/L: 13A200 402C4240 Dest: 0 99 NI: Test Board Ver: 1084 Ready: 99 Send DP:81FFFF00: Send DP:81Ć¢ā‚¬ FFF00: 0000000000000000 127 127 128 38 255 255 New data Packet received Send DP:80030300: New data Packet received Send DP:80040400: Send DP:80050500: Send DP:800606p0: New data Packet received Send DP:80070700: 00`0000000000000 128 127 128 38 255 255 New data Packet received Send DP:80080800: 0000000000000000 127 127 128 38 255 255 New data Packet received Send DP:80090900: New data Packet received Send DP:800A0A00: New data Packet received Send DP:800B0B00: New data Packet received Send DP:800C0C00: Send DP:800D0D00: Send DP:80pĆ¢ā‚¬Ā¦0E00: New data Packet received Send DP:800F0F00: 0000000000000000 128 127 128 38 255 255 New data Packet received Send DP:80101000: 0000000000000000 127 127 128 38 255 255
i.e. does the test program show real packets coming over when move things around are the like?

You can try bumping up the timeouts in xbee_taserial_support.bas. Those are:

[code]#ifndef CXBEEPACKETTIMEOUTMS
CXBEEPACKETTIMEOUTMS con 250 ; how long to wait for packet after we send request
#endif

#ifndef CXBEEFORCEREQMS
CXBEEFORCEREQMS con 1000 ; if nothing in 1 second force a requestā€¦
#endif

#ifndef CXBEETIMEOUTRECVMS
CXBEETIMEOUTRECVMS con 2000 ; 2 seconds if we receive nothing
#endif[/code]
Try doubling each of these and see if it helps. Need to rebuild the phoenix for this.

Will keep looking.
Kurt

:astonished: Very appropriate indeed!

No. I get no real packets from the DIY. It look always like this:

******** XBee Test Program ******** MY: 30 SH/L: 13A200 403333B8 Dest: 0 99 NI: phoenix Ver: 1084 Ready: 99 Send DP:81FFFF00: Send DP:80010100: Send DP:80020200: Send DP:80030300: Send DP:80040400: Send DP:80050500: Send DP:80060600: Send DP:80070700: Send DP:80080800: Send DP:80090900: Send DP:800A0A00: Send DP:800B0B00: Send DP:800C0C00: Send DP:800D0D00: Send DP:800E0E00: Send DP:800F0F00: Send DP:80101000: Send DP:80111100: Send DP:80121200: Send DP:80131300: Send DP:80141400: Send DP:80151500: Send DP:80161600: Send DP:80171700: Send DP:80181800: Send DP:80191900: Send DP:801A1A00: Send DP:801B1B00: Send DP:801C1C00: Send DP:801D1D00: Send DP:801E1E00: Send DP:801F1F00: Send DP:80202000: Send DP:80212100: Send DP:80222200: Send DP:80232300: Send DP:80242400: Send DP:80252500: Send DP:80262600: Send DP:80272700: Send DP:80282800: Send DP:80292900: Ready: 99 Send DP:81FFFF00: Send DP:802A2A00: Send DP:802B2B00: Send DP:802C2C00: Send DP:802D2D00: Send DP:802E2E00: Send DP:802F2F00: Send DP:80303000: Send DP:80313100: Send DP:80323200: Send DP:80333300: Send DP:80343400: Send DP:80353500: Send DP:80363600: Send DP:80373700: Send DP:80383800: Send DP:80393900: Send DP:803A3A00: Send DP:803B3B00: Send DP:803C3C00: Send DP:803D3D00: Send DP:803E3E00: Send DP:803F3F00: Send DP:80404000: Send DP:80414100: Send DP:80424200: Send DP:80434300: Send DP:80444400: Send DP:80454500: Send DP:80464600: Send DP:80474700: Send DP:80484800: Send DP:80494900: Send DP:804A4A00: Send DP:804B4B00: Send DP:804C4C00: Send DP:804D4D00: Send DP:804E4E00: Send DP:804F4F00: Send DP:80505000: Send DP:80515100: Send DP:80525200: Send DP:80535300: Send DP:80545400: Send DP:80555500: Send DP:80565600: Send DP:80575700: Send DP:80585800: Send DP:80595900: Send DP:805A5A00: Send DP:805B5B00:
Then nothing happendsā€¦ Timeout

I tried doubling the constants but it didnā€™t helpā€¦ :imp:

Iā€™m glad your still looking. :smiley:

Double Darn!

OK, so we are not receiving any valid packets back from the transmitter. Did you move any of the joysticks while the test was running? Let me look more to see what debug stuff to have you turn on.

Right now I am in the process of trying to fix my HEX. Not sure of the chicken and the egg here. I had the servo wires for the other two servos running under the hip servo. But you can see in this picture:Burnt-servo.jpg It looks like the bottom of the motor more or less burned through the bottom of the case. The two wires under it as you can see are pretty charred as well. Next to see if those motors are OK or notā€¦ FYI - The servo that fried was a JR-SPORT ST125MG that I picked up when I was a servo or two shortā€¦ Hopefully my spare will work. Ordered 6 more 645s just in caseā€¦
Kurt

Well I think I have my hex back in one piece and now back to the problem at hand.

I assume from your last trace that you changed the MY of your transmitter to 99.

I turned on some debug output in the transmitter program.

here is a partial trace from the run, need to hook up to serial input on Transmitterā€¦ I have two USB to serial connectors hooked up on my machine, so for some runs I open two terminal tabs, split them horizontally and connect to both the transmitter and receiver programs and that way can see how they are responding (or not to each other).

Get Saved Joystick 24 209 Init Timer My99 DL30 Set XBee My: 99 ReadSavedXBeeNDList cnt= 4 CSIN: AA MY: 31 SN: 13A200403C59FF (Kurts CHR3 hex) MY: 30 SN: 13A200402C4240 (Test Board ) MY: 33 SN: 13A200403CAE31 (Kurts Brat ) MY: 37 SN: 13A200405C1CD6 (Axon DeBrat ) CS Computed: AA Send DP:019B0002:0099 Recv:4F4B0D4F TP IN:4F4B0D4F Recv:80313100 Send DP:03463108:00007F7F808F0000 Recv:80323200 SenĆƒÅ’ DP:03473208:00007F7F808F0000 Recv:80333300 Send DP:03483308:00007F7F808F0000 Recv:80343400 Send DP:03493408:00007F7F808F0000 Recv:80353500 Send DP:034A3508:00007F7F808F0000 Recv:80363600 Send@DP:034B3608:00007F7F808F0000 RecƃĀ®:80373700 Send DP:034C3708:00007F7F808F0000 Recv:80383800 Send DP:034D3808:00007F7F808F0000 Recv:80393900 Send DP:034E3908:00007F7F808F0000 Recv:803A3A00 Send DP:034F3A08:00007F7F808F0000 Recv:803B3B00 Send D:03503B08:00007F7F808F0000 Recv:803C3C00 Send DPz03513C08:00007F7F808F0000 Recv:803D3D00 Send DP:03523D08:00007F7F808F0000 Recv:803E3E00 Send DP:03533E08:00007F7F808F0000 Recv:803F3F00 Send DP:03543F08:00007F7F808F0000 Recv:80404000 Send DP:03614008:00007Ć¢ā‚¬ 7F809B0000 Recv:80414100 Send DP:03624108:00007F7Fx09B0000 Recv:80424200 Send DP:03634208:00007F7F809B0000 Recv:80444400 Send DP:03654408:00007F7F809B0000 Recv:80454500 Send DP:03644508:00007F7F80990000 Recv:80464600 Send DP:03654608:00007F7F80990000

The Recv messages are the 4 byte packet headers it receives. If you see a bunch of TP IN messages those are ones that are not understood. May need to later add Timeout messages where we are not receiving whole packet. It was not unusual to have some unknown gunk at the beginning. The code should then try to get rid of everything in the queue which usually then gets things rollingā€¦

Another long shot, but to make sure the my is set properly by the transmitter code. That is maybe double check that if you have the two programs running, go to X-CTU with a third one and do the ATND and see what the MY values are actually set to.

Mine are correct I think:

[code]+++OK
atnd
99
13A200
40548556
35
Kurts DIY XBEE Remot

31
13A200
403C59FF
37
Kurts CHR3 hex
[/code]

Yes, of course :wink: I moved all joysticks and I believe I tried everything. I also tested it with the ā€œdiy transmitter xbee.basā€ program and that worked very fine as always.

Doesnā€™t look very good. You said that two of your servos broke, was the other one also a JR-Sport?

Iā€™ll try the debugging part this evening. I have a rather old PC on my workshop with two serial ports and I believe Iā€™ve two serial cabels too. So Iā€™m looking forward to try it out.

Iā€™ve started doing some modifications on the ā€œdiy transmitter xbee.basā€ for adding a potmeter. So far Iā€™ve modified the AD reading and got the result displayed.
Here are some pictures of the custom part Iā€™m going to use as a stick with potmeter on top:

Iā€™ll have to make one more part for the other joystick.
Iā€™m not sure where to guide the wires yet. Iā€™ll post more info about that later.

Looks good, I put some more debug stuff in and moved some around.
The debug stuff may not print as well as for example in the send packet function I moved the send of the data up in front of the displaying the stuff on the debug terminal as to not slow the packet down by waiting for the 9600 baud serout. But the interrupts from HSERIAL will cause the debug stuff to be screwy. I also only output the 4 bytes of the header and not the whole packet, unless you turn on DEBUG_VERBOSE. Also added some more debug outs on the robot side to see if we are not actually receiving packets. Before I would only display info in the actual program and only if it though data had changed.

I tried changing my MY on the remote from 99 to 88 and it worked and I confirmed it with the USB xbeeā€¦
:confused: :confused: :confused:
Kurt

Edit: I think I may know what was wrong and put an updated file up here :bulb: ā€¦ XBEE_RTS was still defined in DIY Transmitter.bas So the code Probably saw that and went into the XBEE Init code which turned on Flow control. On my Transmitter I am using an APPBEE xbee holder which has true voltage shifter IC in there hooked up to the RTS line so while the input was floating it probably left it low. Where on yours with the Sparkfun adapter it is truely floatingā€¦ So hopefully it will now work. If so you should probably comment out the DEBUG and DEBUG_OUT defines.

:laughing:

That did the magic! Well done Kurt!
The ATND fuction worked now, and I found Phoenix (not an unknown_xx).
I got contact with Phoenix. So it seem to be working better.

But there are some glitches and bugs in the communication (I commented out the debug defines). If I donā€™t move the joysticks the robots start beeping and after about 30 sec there are no contact. There are also some strange stuff comming up on the LCD display too. Iā€™ve not got much time for testing but I feel there are some glitches in the general communications too (now and then).

To be honest, the old diy program that worked all the time seem to do a better job thoughā€¦

Anyway, we are back on track again! 8)

Great sounds like progress!

The glitches with the LCD is that this version of TAserial does not appear to be as immune from timing glitches caused by HSERIAL. But the old one I donā€™t think could handle 115200, which is what we are using to talk to the SSC-32. What I have tried to do is to share all of the same code. Can always revert back to older version. Will have to figure out what the differences are for the 30 second stuff. Should be more or less the sameā€¦

Kurt

Iā€™m pretty sure youā€™ll find a solution for it :wink:
I get your point of using the same files on both, sounds logic and more versatile.

Good luck Kurt.
I donā€™t feel I have much to contribute when it comes to this. I find it hard enough to understand every part in your code at all.

Hi Zenta,
I have not done much yet on this, except I did do a version using the old TASerout, which does appear to work better.

You can try it by using this version of the transmitter file. Maybe I will have to revist the cleaner version that is part of the support file versus this one which appears to have a better handling of the HSERIAL interrupt processingā€¦

Kurt

P.S. - I think I now have 12 new 645 servos coming my way so I should not have any down time if another one blowsā€¦ And it is a nice start toward other projects

Sounds promising! Iā€™m a bit busy today but I hope to try it out this weekend.
Thanks again Kurt!

Thats great! Are you planning to replace some of the JR servos or building something new?

I did also got 5 XBeeā€™s and 5 regulated boards today. Iā€™m looking forward to try out your new code and hopefully soon start on mounting the XBeeā€™s on all my robots too.

Iā€™ll let you know when Iā€™ve tested your latest code.

Sounds like fun with the XBEES. That is why I did the stuff to allow you to choose from a list as I kept forgetting which ID I gave to the Brat or the CHR or ā€¦
Will debug more about the dropping. Right now I am playing with the run a GP sequence. there are bugs in my current uploaded code that on some of the calls to TASerout and TASerin are missing @s on some of the calls with the bufferā€¦ But since I had no sequences I did not test much :open_mouth: . While I was looking that the code and trying to debug some stuff Robot Dude had questions on I did try running some sequences that were not defined and I think I hung the SSC-32. So I modified the code for the XBEE that first checks to see if it thinks a sequence is defined (does a EER -<sequence Number*2>;2) and then does a read for the two bytes. If they are 0 or 0xff then error out. Also while I was doing it, I thought I would define text messages that display when you start the sequence and end the sequence and if there is an error. Just finished coding and compiling, to find out I ran out of program space if I have some debug stuff turned on. So maybe I need to cleanup some more, maybe get rid of some messages, ā€¦ !

As for servos, I bought them to maybe build a phoenix over time. Still need another 6 servos and then the bracketsā€¦

Kurt

Hi Kurt,

Iā€™ve tested the latest ā€œdiy transmitter.basā€. At first try I didnā€™t get contact with Phoenix at all. Then I tried the old ā€œdiy transmitter xbee.basā€ again. I got contact with Phoenix and I was able to control it, but when the joysticks wasnā€™t moved Phoenix started beeping againā€¦? :confused: I concluded that the new ā€œxbee_taserial_support.basā€ was the reason, so I replaced this file with the old one dated december 23. and compiled the phoenix code again.

After that, the Phoenix didnā€™t start beeping (timeout) due to no joystick movement.

Then I tried your latest ā€œdiy transmitter.basā€ file and compiled the diy project again.
And the DIY remote worked perfect! 8) No timeout issue or glitching at all.

I also tested one of my new XBee modules with ATNI= T-Hex and MY=31. Did the (A) ATND on the DIY and it found the T-Hex module at first try. The DIY did also changed the DL to 31 correctly!

Iā€™ve no idea why I needed to compile the phoenix code with the older "xbee_taserial_support.bas.? I guess you know the answer to that Kurt :wink:

Anyway, the DIY remote seem to work very fine!. Thanks Kurt.

Iā€™ve some sequences stored on my SSC, so I can test it out for you.

A Phoenix sounds like a good choice! :wink:

Hi Zenta,
Sorry I am a little slow respondingā€¦ Handsā€¦

Note sure why you were having problems with TASERIAL stuff on phoenix. Here is my current stuff. I was able to talk ok with my chr-3. It also has the code that hopefully should run canned sequences properly. Mine just tells me that each of the sequences is not definedā€¦

Iā€™m sorry about your hands Kurt.

Iā€™ve tested your latest code. Just for a very short period of time, Iā€™ve very little time for robotics in the weekends (family stuff).

The DIY remote and robot communication seem to work fine.
But I didnā€™t manage to run a sequence. I hit the ā€œFā€ button for entering sequence mode, then hit the ā€œ1ā€ button for playing sequence 0 (is that correct?). The LCD display show ā€œStart Seqenceā€ (a tiny typoā€¦ :wink: ). Nothing happends and the display show ā€œWalkingā€ again.

Iā€™ll take a closer look into your code later to see if I can find it out why the sequence doesnā€™t play.

Thanks!

I know I should probalby try to define a sequence and download itā€¦ Am playing with your excel SS to see if I can make it talk through the BAP to the SSC-32. Trying to convert from VB to the VBA using the Comm macros you were using. Trying to figure out for example when you read in the SSC-32 version. I think you just wait for the timeout to happen from the SSC-32 and assume all of the bytes.

As for 1 playing sequence 0, I think that is what Xan did before I XBeed itā€¦ As for showing Walking, it is called copy and paste and not updating the message pointer. Look at the code:

[code]ControlInput:
#ifdef DEBUG_ENTERLEAVE
serout s_out, i9600, ā€œEnter: Control Inputā€, 13]
#endif
; Not sure the best place to test this, but if we ran a sequence and now
; it says it is not running, let the user know this.
if fGPSequenceRun and (GPStart = 0) then
fGPSequenceRun = 0 ; clear out the dataā€¦
gosub XBeeOutputString@_GPSEQCOMPLETE]

endif

[/code]
You will notice that the output string in the code has the WAlk not complete message pointer. :blush:

So it thinks it completed. I assume you also picked up the updated phoenix_v21K file. If not you may want to look at where I was calling up the sequence, probably a couple @s missingā€¦

As for the previous message. Yes I would like to build the phoenix, but was hoping Jim would release the version of the legs with the contact switches so I can play with thoseā€¦

Kurt

Hi Kurt,

Iā€™ve been trying to figure out why the sequence wonā€™t play. But something strange happend when I turned on the main debug. While the ā€œmain debugā€ was turned on, the sequence played! And all the statsdata was streaming on to the terminal window. Then after the sequence was finished the servos got turned off or something. I had to hit the ā€œ0ā€ button again for making it walk. Strangeā€¦ :confused: When the main debug are turned off the sequence wonā€™t play again. I tried adding a little pause in the GPWait loop, but that didnā€™t help. Any idea?

Another thing: I guess you didnā€™t try the body rotation with your current code?.. The code I sent you was modified with 0,1 deg resolution for the bodyrotation. Youā€™ve to modify some parts of the phoenix_V21K.bas code and the phoenix_control_diy.bas file. Or if you want, I can post the code again.