PDA

View Full Version : Sucessful users of PyPose/NUKE, how is your system configured?



escott76
05-24-2013, 11:11 AM
Looking to find out what versions of what software people that are successful with NUKE are using.
Here's what I am using

Win 7 64 Bit
Python 2.7.5 (tried both 64/32 bit currently 32)
wxpython2.8 (tried both 64/32 bit currently 32)
pyserial2.5

PyPose works, I can capture and replay poses and sequences, but things get flakey starting NUKE. When I can get past the selection for leg numbers without the screen going haywire I cannot get the sign test to run. All dynamixel numbers are set the same as the TR quad, and I change the numbers in NUKE to reflect this.
I have an XP box that I can use, but I'd rather not. I've got a Ubuntu drive that will work in that system as well, but I REALLY don't want to have to do that at the moment. I also have the OSX side of the Mac that runs Win7, but again I would rather not use that. I could also install ubuntu into a VM and work with that, again an avenue that I would rather not walk down.
Any help is appreciated.

Lupulus
05-24-2013, 11:52 AM
Here is what I've been using. It's worked really smoothly for me, other than sometimes freezing when I try to close.

Win 7 64bit, service pack 1
Python 2.7.1, 32 bit
wxPython 2.8, 32 bit
pyserial 2.5

Possibly important: I'm using Pypose/NUKE v0013. I tried v0015, and got some errors in NUKE related to the "mammal3" module. Looks like this is missing from the zip download? Anyway, went back to 0013 since there wasn't really anything relevant to me in the newer version.

Does NUKE actually crash for you when it's flaking out? Do you get any Traceback for errors that might help diagnose what's going on?

escott76
05-24-2013, 12:04 PM
Here is what I've been using. It's worked really smoothly for me, other than sometimes freezing when I try to close.

Win 7 64bit, service pack 1
Python 2.7.1, 32 bit
wxPython 2.8, 32 bit
pyserial 2.5

Possibly important: I'm using Pypose/NUKE v0013. I tried v0015, and got some errors in NUKE related to the "mammal3" module. Looks like this is missing from the zip download? Anyway, went back to 0013 since there wasn't really anything relevant to me in the newer version.

Does NUKE actually crash for you when it's flaking out? Do you get any Traceback for errors that might help diagnose what's going on?

I am not a python guy, so this will sound stupid to anyone who might be. I also am not in front of that machine right not. When I start the sign test I get something about line 325 in pypose and something about self.model or something similar. It doesn't kill the program completely, but afterwards stuff doesn't work right.

I will have to try the earlier version of NUKE.

Lupulus
05-24-2013, 12:57 PM
I'm not really an "anything" guy in terms of programming--but I'm slowly teaching myself Python as a start :)

Our problems with v0015 may be related. I just opened up the program again, and I think there's at least 2 issues:

--In the folder pypose-->tools-->models, there's a folder called "lizard3" containing the lizard3 module; a folder called "mammal3" which is empty; and nothing at all named "biped". Unsurprisingly, if I select mammal or biped in NUKE, I get an import error. I'm not sure if fergs forgot to include these modules in the release, or if the options in NUKE are just supposed to be placeholders for now.

--If I choose Lizard, it seems to work...until I select the number of legs, and then the GUI window goes screwy. There's no error message. Perhaps something's wrong with wx.sizer functions? Not sure how to start diagnosing this. I've never had this happen in v0013.

escott76
05-24-2013, 01:08 PM
--If I choose Lizard, it seems to work...until I select the number of legs, and then the GUI window goes screwy. There's no error message. Perhaps something's wrong with wx.sizer functions? Not sure how to start diagnosing this. I've never had this happen in v0013.

This is the behavior I was describing when I said the window goes haywire above. It's somewhat random when it happens and when it doesn't. If it does not happen in v0013 that's a start in the right direction. I will only be using the Lizzard style for now.
I cannot seem to find v0013 out there anywhere with a quick search. Anyone want to point me in the right direction?

Lupulus
05-24-2013, 01:29 PM
You can find the old versions on the Arbotix downloads page by switching your search from Current to All. Here's the link for the download I used: http://code.google.com/p/arbotix/downloads/detail?name=arbotix-0014.zip&can=1&q=
(This is arbotix-0014.zip, but the pypose it contains is v0013)

Good luck--it's a very cool moment when NUKE gets your robot walking!

Gertlex
05-24-2013, 03:11 PM
I am not a python guy, so this will sound stupid to anyone who might be. I also am not in front of that machine right not. When I start the sign test I get something about line 325 in pypose and something about self.model or something similar. It doesn't kill the program completely, but afterwards stuff doesn't work right.

A python guy should appear and help, if you copy paste the error into a post and use [ code ] [/code ] tags :)

escott76
05-24-2013, 03:15 PM
v0013 is a swing and a miss sadly. As far as I can tell it only will work with the AX series, as the other versions have the option of 4096 resolution when starting a new project file. Maybe there is somewhere to set this, but it does not appear to be so. I am using MX28's so I require this feature.

escott76
05-24-2013, 04:46 PM
When I bring up pypose and load the project file everything comes up fine. Open the port, still fine. When I switch into NUKE all of my previous values are filled out from the last time I filled them out with the exception of the number of legs. Everything else is there but greyed out, and the cursor is set on the number of legs with nothing in the dropdown shown. I select 4 from the dropdown, and bam! All values are wiped out back to stock values. If I switch back to the pose window and then back again to NUKE again the leg value isn't filled out and the other fields are grey.



PyPose starting...
Opening: C:\Users\Eric\Documents\zoidberg001.ppr
Opening port: COM3
Opening: C:\Users\Eric\Documents\zoidberg001.ppr
Traceback (most recent call last):
File "tools\NukeEditor.py", line 325, in doSignTest
self.configModel()
File "tools\NukeEditor.py", line 305, in configModel
model.config( [int(v.GetValue()) for v in self.vars], [int(s.GetValue()) for
s in self.servos])
File "tools/models/lizard3\lizard3.py", line 98, in config
self.legs = int(opt)
TypeError: int() argument must be a string or a number, not 'list'


Seems to the untrained eye that the number of legs is somehow at issue here.

escott76
05-24-2013, 08:24 PM
Same terminal error as above on a Mac with Mountain Lion (10.8.3). On the plus side I can load a file and have NUKE not wipe out the numbers when I set it to 4 legs. It does not however run the sign test.

lnxfergy
05-24-2013, 11:55 PM
Where did you install from? Have you tried the auto-generated-zip from github? http://github.com/vanadiumlabs/arbotix/zipball/master

-Fergs

escott76
05-25-2013, 08:29 AM
Where did you install from? Have you tried the auto-generated-zip from github? http://github.com/vanadiumlabs/arbotix/zipball/master

-Fergs
Yup, that is where I get the errors from.

lnxfergy
05-25-2013, 05:05 PM
I guess I posted the wrong link up there also -- that is for arbotix, not pypose, you have downloaded this though right: http://github.com/vanadiumlabs/pypose/zipball/master ?

I can't reproduce this error -- but I'm also not on Windows. Did you create your .ppr file with an earlier version?

-Fergs

lnxfergy
05-25-2013, 05:08 PM
Also, would you mind uploading your .ppr file? That might help me test it to see if something got garbled in the file.

-Fergs

escott76
05-25-2013, 06:23 PM
Well, I have been trying both Windows 7 and OSX10.8.3, both downloaded from the same Github by hitting the zip download button. Both make the same ppr file. Not sure how I would be uploading it, but I can post it with the code tags here :



Zoidberg:12:4096:4096:4096:4096:4096:4096:4096:409 6:4096:4096:4096:4096
Pose=test:2083, 1536, 2614, 1623, 1469, 2077, 1532, 2587, 2593, 1645, 1458, 2602
Pose=ik_neutral:2557, 1536, 2614, 1623, 1470, 2077, 1532, 2588, 2593, 1645, 1458, 2602
Pose=ik_min:1074, 1120, 1430, 902, 299, 2570, 1054, 1090, 1555, 883, 291, 3064
Pose=ik_max:3005, 3035, 3194, 2652, 1067, 3292, 3004, 3023, 3189, 2636, 1045, 3783
Nuke=Lizard 3DOF,4,++++++++++++++++++,50,50,100,60,60,50,0,0,1 ,2,3,4,5,6,12,12,12,12,12,12,7,8,9,10,11,12



I get the same error with either one in the sign test function. On Mac I get some other errors in the terminal which I believe to be related to wx but don't seem to effect opperation, I'm also using wx2.9 I think there.

Let me also ask this, is there a way to "manually" determine my signs, I can hand edit the config file, load it, and export a sketch. Maybe that will work. Thanks for trying to help. What OS are you working with? Since I get the same error with either OS (granted they are on the same box) I have a hard time seeing how that could be at fault but I can try another box if that might be a help.

lnxfergy
05-25-2013, 08:44 PM
Could you download http://github.com/vanadiumlabs/pypose/zipball/master, which will now be updated with a patch to the config model function. This makes sign test work on my machine (I somehow missed the sign test aspect above, I thought you were saying as soon as you switched into the NukeEditor it failed).

For reference, I do all my work on Ubuntu. It did end up the sign test function was not working for me either, but it does with this latest patch. I cannot replicate the "legs box being empty" bug though, so if that is still affecting you, that will be harder to solve.

-Fergs

escott76
05-25-2013, 09:02 PM
Progress, somewhat. Sign test now starts but when it does the bot curls up into a pose such that some of the legs interfere with each other. iKneutral is set and works correctly under the pose editor.

Lupulus
05-25-2013, 11:19 PM
Escott, one thing to try is double-checking your body dimensions. Sign test uses those to determine initial leg positions. (Guess who made this mistake the first time using sign test :tongue:)

I'm also interested in getting the new Pypose/NUKE working smoothly under Windows. Thanks for posting the patched version Fergs! Should be able to try it out and report back tomorrow.

escott76
05-26-2013, 08:16 AM
Escott, one thing to try is double-checking your body dimensions. Sign test uses those to determine initial leg positions. (Guess who made this mistake the first time using sign test :tongue:)

I'm also interested in getting the new Pypose/NUKE working smoothly under Windows. Thanks for posting the patched version Fergs! Should be able to try it out and report back tomorrow.

As far as I know they are correct, they are the same dimensions I used when I made the model in CAD. When I say "curl up into a pose" I mean it seems as if all the servos move to one extreme. At least one tibia moves upwards. I can't be sure of this 100% but at one point I loaded the included nuke code for the TR quad to the Arbotix, thinking it might work to use with test drive. When I turned the bot on it made a similar (possibly the same, that's the not %100 part) pose. I had not thought at the time, but that code isn't set up for the MX servos, perhaps the issue that I see is related to this? I was pretty sure that there were some other folk using this with the MX servos, although the comment Fergs made about how many of the Trossen kits are out there makes me think that there may not be a whole lot.
I will double check the body dimensions in real life and ensure everything matches though.
I did download an Ubuntu image to run on a VM just because. My preference in the end would be to have it work on OSX, which it has been doing at least as well as it has in Windows. At this point I'll take whichever one works though ;)
I'm working to manually get a series of poses together to take a forward step that I can loop in the meantime. Takes a while!

lnxfergy
05-26-2013, 03:16 PM
I was pretty sure that there were some other folk using this with the MX servos, although the comment Fergs made about how many of the Trossen kits are out there makes me think that there may not be a whole lot.

Yeah, I added the MX-stuff for Tyberius a while back -- but I've never had an MX-based walker to actually test on -- so it is very possible that there are kinks to still be worked out.

-Fergs

escott76
05-26-2013, 03:53 PM
Yeah, I added the MX-stuff for Tyberius a while back -- but I've never had an MX-based walker to actually test on -- so it is very possible that there are kinks to still be worked out.

-Fergs

Although I'm very new to python, I've read through this code almost enough to think that I know what is going on with it. Sooner or later I will actually understand it. I've got a few more things to try, I want to see if I restricting the travel through the upper and lower limits might help. I have seen the vids of his MX64 based quad, and the geometry differs slightly from mine.
Thanks for your help Fergs, I know I will at some point prevail.

Lupulus
05-26-2013, 05:41 PM
I'm getting similar issues with my AX-12 robot, so I'm guess the primary issue is operating system and not MX vs AX.

Here's a summary of what I experienced today. (Let me know if I should move this to a new thread...)

1) Started up pypose v0015 from new patched download. Created a new project file, played around with Pose editor a bit. Working great, loving the ability to turn servos on and off.

2) Switched to NUKE mode.
4766

3) Changed IK Type to Lizard. More options appear, looks promising.

4767

4)Selected # of legs = 4....and my GUI kinda disappeared. No error tracebacks for errors appear.
4768

5) At this point, I saved and exited. Then I started back up, reopened my project, and went back to NUKE. I had to select the # of legs again, but his time my GUI stayed. Success!
4765

6) Entered all my servo assignments and dimensions. Captured the Neutral pose, captured servo limits, and saved.

7) Went to Pose editor to check that my neutral and limits saved, all looks fine. When I went back to NUKE, things looked OK except that the #of legs was back to blank. Dimensions and servo assignments were fine but greyed out. When I selected 4 legs again, my dimensions and servos were all set back to default. I've checked this a few times, and NUKE v0015 does this every time for me. Even when I open an old project created in v0013, # of legs opens blank, and when I choose a value all my other values get reset.

8) Continuing on with my new project, I re-entered all the assignments and dimensions and saved again. Then I tried "Set/Test Signs"...robot contortions! Servos going in random directions, limbs clashing with red light failures. I decided to continue the sign test anyway, and with the first question the only servo that moves is my turret servo rather than the leg. Something seems very wrong with servo assignments.

TL;DR: 3 (related?) issues: GUI tweaks out when selecting #of legs first time in a new project; NUKE loses the value for # of legs, and then sets all other values to default when # of legs is re-selected; sign test contorts robot, as if servo assignments have been mangled.

lnxfergy
05-26-2013, 06:54 PM
TL;DR: 3 (related?) issues: GUI tweaks out when selecting #of legs first time in a new project; NUKE loses the value for # of legs, and then sets all other values to default when # of legs is re-selected; sign test contorts robot, as if servo assignments have been mangled.

Are you using the ZIP from github? We did have a problem like this once before, but I think it was fixed. If you run PyPose from the command line, do you get any errors there (and if so, what are they)?

-Fergs

escott76
05-26-2013, 06:54 PM
This is exactly the same scenario, thanks for taking the time to document!
In Mac it does the same thing, from the command line I run :


python2 ./PyPose.py


I found the same in Windows, only I don't use the "python2" argument since there is no python3 on that system.

Lupulus
05-26-2013, 08:21 PM
Are you using the ZIP from github?

Yes, I am using the ZIP from github. [vanadiumlabs-pypose-dd70200.zip] However, the pypose arduino sketch running on the arbotix is from the google code page [arbotix0014.zip] if that makes a difference.


If you run PyPose from the command line, do you get any errors there (and if so, what are they)?

No errors pop up, unfortunately. Here's a run-through in which I set the pose to IK_neutral in the pose editor, switched to NUKE, re-assigned the servos since they got set back to default, and then started sign test. I wasn't able to recognize any red flags in the command line.


PyPose starting...
Opening: C:\Python27\vanadiumlabs-pypose-dd70200\qalvintest1.ppr
Opening port: COM6
Setting pose...
Setting pose size at 14
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Moving to neutral positions
RIGHT_FRONT: [0, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
RIGHT_REAR: [0, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_FRONT: [0, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_REAR: [0, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
RIGHT_FRONT: [24, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [45, 3, 0, 0]
RIGHT_REAR: [0, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_FRONT: [0, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_REAR: [0, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Reversing RF Coxa sign
RIGHT_FRONT: [24, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [45, 3, 0, 0]
RIGHT_REAR: [0, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_FRONT: [0, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_REAR: [0, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
RIGHT_FRONT: [24, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [45, 3, 0, 0]
RIGHT_REAR: [0, 102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_FRONT: [24, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [45, 3, 0, 0]
LEFT_REAR: [0, -102, 121]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Fail Read
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255

lnxfergy
05-26-2013, 11:15 PM
Unfortunately, I can't replicate any of those failures in the leg# box on my Ubuntu system. I just added a bit more logging into the function that runs when the NUKE editor is first loaded -- if someone gets a chance to run it and post the output, it might be helpful.

-Fergs

escott76
05-27-2013, 12:42 PM
Got the Ubuntu image up and running. I don't see the leg number issue there, but when I do start the sign test the legs contort wildly again. Started totally fresh, downloaded the Zip master from Github. Brand new Ubuntu 11.04 image, I did install wxpython, it said pyserial and python were already there.



ID found: 5
Length found: 4
Error level found: 0
Parameter found: 40
Parameter found: 4
Checksum found: 202
Checksum computed: 255
Capture Limits 5 : 1064 to 4056
Oxff found
Oxff found
ID found: 6
Length found: 4
Error level found: 0
Parameter found: 12
Parameter found: 14
Checksum found: 219
Checksum computed: 255
Oxff found
Oxff found
ID found: 6
Length found: 4
Error level found: 0
Parameter found: 211
Parameter found: 9
Checksum found: 25
Checksum computed: 255
Capture Limits 6 : 2515 to 3596
Oxff found
Oxff found
ID found: 7
Length found: 4
Error level found: 0
Parameter found: 53
Parameter found: 4
Checksum found: 187
Checksum computed: 255
Oxff found
Oxff found
ID found: 7
Length found: 4
Error level found: 0
Parameter found: 140
Parameter found: 11
Checksum found: 93
Checksum computed: 255
Capture Limits 7 : 1077 , 2956
Oxff found
Oxff found
ID found: 8
Length found: 4
Error level found: 0
Parameter found: 79
Parameter found: 4
Checksum found: 160
Checksum computed: 255
Oxff found
Oxff found
ID found: 8
Length found: 4
Error level found: 0
Parameter found: 190
Parameter found: 11
Checksum found: 42
Checksum computed: 255
Capture Limits 8 : 1103 , 3006
Oxff found
Oxff found
ID found: 9
Length found: 4
Error level found: 0
Parameter found: 219
Parameter found: 5
Checksum found: 18
Checksum computed: 255
Oxff found
Oxff found
ID found: 9
Length found: 4
Error level found: 0
Parameter found: 22
Parameter found: 12
Checksum found: 208
Checksum computed: 255
Capture Limits 9 : 1499 , 3094
Fail Read
Read Failed: Servo ID = 10
Oxff found
Oxff found
ID found: 10
Length found: 4
Error level found: 0
Parameter found: 27
Parameter found: 10
Checksum found: 204
Checksum computed: 255
Oxff found
Oxff found
ID found: 10
Length found: 4
Error level found: 0
Parameter found: 246
Parameter found: 3
Checksum found: 248
Checksum computed: 511
Capture Limits 10 : 1014 to 2587
Oxff found
Oxff found
ID found: 11
Length found: 4
Error level found: 0
Parameter found: 0
Parameter found: 16
Checksum found: 224
Checksum computed: 255
Oxff found
Oxff found
ID found: 11
Length found: 4
Error level found: 0
Parameter found: 12
Parameter found: 4
Checksum found: 224
Checksum computed: 255
Capture Limits 11 : 1036 to 4096
Oxff found
Oxff found
ID found: 12
Length found: 4
Error level found: 0
Parameter found: 244
Parameter found: 15
Checksum found: 236
Checksum computed: 511
Oxff found
Oxff found
ID found: 12
Length found: 4
Error level found: 0
Parameter found: 37
Parameter found: 12
Checksum found: 190
Checksum computed: 255
Capture Limits 12 : 3109 to 4084
Relax servos for capture...
PyPose: relaxing servos...
Oxff found
Oxff found
ID found: 1
Length found: 2
Error level found: 0
Checksum found: 252
Checksum computed: 255
Oxff found
Oxff found
ID found: 2
Length found: 2
Error level found: 0
Checksum found: 251
Checksum computed: 255
Oxff found
Oxff found
ID found: 3
Length found: 2
Error level found: 0
Checksum found: 250
Checksum computed: 255
Oxff found
Oxff found
ID found: 4
Length found: 2
Error level found: 0
Checksum found: 249
Checksum computed: 255
Oxff found
Oxff found
ID found: 5
Length found: 2
Error level found: 0
Checksum found: 248
Checksum computed: 255
Oxff found
Oxff found
ID found: 6
Length found: 2
Error level found: 0
Checksum found: 247
Checksum computed: 255
Oxff found
Oxff found
ID found: 7
Length found: 2
Error level found: 0
Checksum found: 246
Checksum computed: 255
Oxff found
Oxff found
ID found: 8
Length found: 2
Error level found: 0
Checksum found: 245
Checksum computed: 255
Oxff found
Oxff found
ID found: 9
Length found: 2
Error level found: 0
Checksum found: 244
Checksum computed: 255
Oxff found
Oxff found
ID found: 10
Length found: 2
Error level found: 0
Checksum found: 243
Checksum computed: 255
Oxff found
Oxff found
ID found: 11
Length found: 2
Error level found: 0
Checksum found: 242
Checksum computed: 255
Oxff found
Oxff found
ID found: 12
Length found: 2
Error level found: 0
Checksum found: 241
Checksum computed: 255
Capturing neutral...
Oxff found
Oxff found
ID found: 1
Length found: 4
Error level found: 0
Parameter found: 237
Parameter found: 9
Checksum found: 4
Checksum computed: 255
Oxff found
Oxff found
ID found: 2
Length found: 4
Error level found: 0
Parameter found: 5
Parameter found: 6
Checksum found: 238
Checksum computed: 255
Oxff found
Oxff found
ID found: 3
Length found: 4
Error level found: 0
Parameter found: 243
Parameter found: 9
Checksum found: 252
Checksum computed: 511
Oxff found
Oxff found
ID found: 4
Length found: 4
Error level found: 0
Parameter found: 3
Parameter found: 6
Checksum found: 238
Checksum computed: 255
Oxff found
Oxff found
ID found: 5
Length found: 4
Error level found: 0
Parameter found: 9
Parameter found: 6
Checksum found: 231
Checksum computed: 255
Oxff found
Oxff found
ID found: 6
Length found: 4
Error level found: 0
Parameter found: 6
Parameter found: 8
Checksum found: 231
Checksum computed: 255
Oxff found
Oxff found
ID found: 7
Length found: 4
Error level found: 0
Parameter found: 240
Parameter found: 5
Checksum found: 255
Checksum computed: 511
Oxff found
Oxff found
ID found: 8
Length found: 4
Error level found: 0
Parameter found: 243
Parameter found: 9
Checksum found: 247
Checksum computed: 511
Oxff found
Oxff found
ID found: 9
Length found: 4
Error level found: 0
Parameter found: 251
Parameter found: 9
Checksum found: 238
Checksum computed: 511
Oxff found
Oxff found
ID found: 10
Length found: 4
Error level found: 0
Parameter found: 255
Parameter found: 5
Checksum found: 237
Checksum computed: 511
Oxff found
Oxff found
ID found: 11
Length found: 4
Error level found: 0
Parameter found: 246
Parameter found: 5
Checksum found: 245
Checksum computed: 511
Oxff found
Oxff found
ID found: 12
Length found: 4
Error level found: 0
Parameter found: 243
Parameter found: 9
Checksum found: 243
Checksum computed: 511
Moving to neutral positions
RIGHT_FRONT: [0, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
RF_TIBIA FAIL: 2054
RIGHT_REAR: [0, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
RR_TIBIA FAIL: 2547
LEFT_FRONT: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_REAR: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff NOT found, restart: 115
Oxff NOT found, restart: 101
Oxff NOT found, restart: 58
Oxff NOT found, restart: 13
Oxff NOT found, restart: 10
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
RIGHT_FRONT: [25, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [12, 0, 1, 0]
RF_TIBIA FAIL: 2055
RIGHT_REAR: [0, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
RR_TIBIA FAIL: 2547
LEFT_FRONT: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_REAR: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Fail Read
Fail Read
Fail Read
Fail Read
Reversing RF Coxa sign
RIGHT_FRONT: [25, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [12, 0, 1, 0]
RF_TIBIA FAIL: 2055
RIGHT_REAR: [0, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
RR_TIBIA FAIL: 2547
LEFT_FRONT: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_REAR: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Fail Read
Fail Read
Fail Read
Fail Read
RIGHT_FRONT: [25, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [12, 0, 1, 0]
RF_TIBIA FAIL: 2055
RIGHT_REAR: [0, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
RR_TIBIA FAIL: 2547
LEFT_FRONT: [25, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [12, 0, 1, 0]
LEFT_REAR: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
Fail Read
Fail Read
Fail Read
Fail Read
Opening: /home/parallels/Desktop/Zoidberg.ppr
Opening port: /dev/ttyUSB0
Setting pose...
Setting pose size at 12
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Setting pose...
Setting pose size at 12
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff NOT found, restart: 13
Oxff NOT found, restart: 10
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
NUKE: Lizard 3DOF,4,+-++++++++++++++++,50,50,100,60,60,50,0,0,1,2,3,4,5, 6,12,12,12,12,12,12,7,8,9,10,11,12


(python:2178): Gtk-CRITICAL **: IA__gtk_window_resize: assertion `width > 0' failed


That's some of the capture, I will work on getting a cleaner one that only shows loading the file and staring the sign test in a little while.
I bailed on the leg test, I clicked a couple of buttons, eventually got the close window to work.

escott76
05-27-2013, 12:47 PM
PyPose starting...
Opening: /home/parallels/Desktop/Zoidberg.ppr
Opening port: /dev/ttyUSB0
NUKE: Lizard 3DOF,4,++++++++++++++++++,50,50,100,60,60,50,0,0,1 ,2,3,4,5,6,12,12,12,12,12,12,7,8,9,10,11,12


(python:2263): Gtk-CRITICAL **: IA__gtk_window_resize: assertion `width > 0' failed


From a fresh restart of pypose.

Lupulus
05-27-2013, 07:49 PM
Tried out the new distribution [vanadiumlabs-pypose-e6ae9ad.zip]. Still having the same issues on my Windows 7 laptop...

lnxfergy
05-28-2013, 03:09 AM
So, a couple of things stand out in this log:

Limits on servo 11, go to 4096? valid ranges are only 0-4095.. odd, not sure about this.

But then I went back and looked at your previous .ppr file. And that's when I noticed that, on servo 5:

min = 299, max = 1067, but neutral is 1470... this is the same for 6, 11, and 12.

So, how are you servos mounted? You need to be absolutely sure that you don't ever pass through servo value = 0 when capturing limits (otherwise, the limits will be inverted). If you are passing through 0, then you need to physically adjust the servo horns. You are definitely getting an out-of-range error for servos 5, 6, 11, and 12 when sending the neutral pose, which would cause the robot to contort. I guess we should add better error checking for that....

Not sure what else might be wrong, but certainly fix those servo positions and give it another go.

-Fergs

escott76
05-28-2013, 05:31 AM
So, a couple of things stand out in this log:

Limits on servo 11, go to 4096? valid ranges are only 0-4095.. odd, not sure about this.

But then I went back and looked at your previous .ppr file. And that's when I noticed that, on servo 5:

min = 299, max = 1067, but neutral is 1470... this is the same for 6, 11, and 12.

So, how are you servos mounted? You need to be absolutely sure that you don't ever pass through servo value = 0 when capturing limits (otherwise, the limits will be inverted). If you are passing through 0, then you need to physically adjust the servo horns. You are definitely getting an out-of-range error for servos 5, 6, 11, and 12 when sending the neutral pose, which would cause the robot to contort. I guess we should add better error checking for that....

Not sure what else might be wrong, but certainly fix those servo positions and give it another go.

-Fergs

So basically the Tibia servos. The way mine are mounted there is approximately 270ish degrees of range. When I designed it, I wasn't thinking that 0 mattered, as the MX series has no deadband like the AX's. I thought as long as I stayed at less that a full rotation I'd be fine.
I will take a look at the positions later today though, Thanks!

jwatte
05-28-2013, 12:17 PM
You can always compensate for a zero position mismatch by simply screwing the brackets to the horn in a different orientation. The horn is 8-way symmetric, so you can compensate by 45 degrees at a time this way.
Thus, write your code to assume that "0" is any one of the 8 semi-cardinal directions relative to the servo body, and then screw in the brackets to the horn accordingly, and you will be fine!

escott76
05-28-2013, 01:55 PM
You can always compensate for a zero position mismatch by simply screwing the brackets to the horn in a different orientation. The horn is 8-way symmetric, so you can compensate by 45 degrees at a time this way.
Thus, write your code to assume that "0" is any one of the 8 semi-cardinal directions relative to the servo body, and then screw in the brackets to the horn accordingly, and you will be fine!
I think at this point I can figure out how to move a servo horn :)
It's not that I don't understand the concept, it's that I didn't understand that it mattered or was used here. Makes sense now that I think about it. I'm also not writing any code here (yet). I'm using something someone else wrote, and I don't fully understand.
I need to look at what positions the servos move through and position them so that it doesn't pass through zero.
The other thing I could do is to help document some of this stuff so that other folks know about it. If there's a place I can help contribute Fergs please let me know.

escott76
05-28-2013, 04:23 PM
ZOID:12:4096:4096:4096:4096:4096:4096:4096:4096:40 96:4096:4096:4096
Pose=ik_min:1237, 1258, 1731, 1042, 1021, 1055, 1219, 1231, 1600, 1025, 1033, 977
Pose=ik_neutral:2504, 1552, 2514, 1552, 1470, 2555, 1496, 2531, 2547, 1486, 1528, 2522
Pose=ik_max:2849, 2881, 3069, 2352, 3078, 3050, 2846, 2846, 3065, 2473, 3066, 3061
Nuke=Lizard 3DOF,4,++++++++++++++++++,50,50,100,60,60,50,0,0,1 ,2,3,4,5,6,12,12,12,12,12,12,7,8,9,10,11,12


Bot still contorts when I start a sign test. I didn't need to adjust the servo horns, the tibias were the only ones that were passing zero and I did not need the full range of motion or anywhere close to it.

escott76
05-30-2013, 05:42 PM
Possibly stupid question : Which way is the front of the bot in the diagram shown? Are the coxa/femurs pointing forward and back or are they pointing out from the sides?
Still no joy either way (tried pointing forward/back and capturing limits just to be sure). In fact the servos are actually moving to positions outside of the ikmin/ikmax positions during the contortion phase.



RIGHT_FRONT: [0, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
RIGHT_REAR: [0, 100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_FRONT: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]
LEFT_REAR: [0, -100, 100]
BodyIK: [0.0, 0.0, 0]
LegIK: [0, 0, 0, 0]


Is the output when I run the sign test.

Lupulus
05-31-2013, 09:06 AM
The front of the bot is towards the front of the picture, with the legs pointing out to the sides. Put another way, the two front coxas should be colinear.

I haven't managed to find the cause of the sign test issues either. My guess is that when the lizard3.py module is called, all of the servo assignments which should be passed to lizard3 get reset to default instead. Haven't had time to really try nailing it down though...

escott76
05-31-2013, 09:17 AM
The front of the bot is towards the front of the picture, with the legs pointing out to the sides. Put another way, the two front coxas should be colinear.

I haven't managed to find the cause of the sign test issues either. My guess is that when the lizard3.py module is called, all of the servo assignments which should be passed to lizard3 get reset to default instead. Haven't had time to really try nailing it down though...
Every night I put a couple hours into trying to trace the issue. I'm still learning both python, and the math behind what's going on so it's difficult. Here are a couple of assumptions I am making that I am trying to use to track down the issue:
1. Happens regardless of servo resolution
2. Previous versions worked, although they only used one resolution

My current theory has to do with something about the neutral position and min/maxes. The loading of them are handled in one section of the NUKE editor program, not in the model itself's config function (why I don't know).

Lupulus
05-31-2013, 09:55 AM
I'm still learning both python, and the math behind what's going on so it's difficult.

Sounds like we are in the same boat. There's major changes between v0013 which works for me and v0015 which does not, so it's been slow tracking down the problem.

Hopefully we'll get there (maybe someone will swoop in and help). Good luck!

escott76
05-31-2013, 03:42 PM
There's another question I have not got an answer to. Is there a way to determine the signs by another means? For instance, if I look at the servo numbers, would an increasing number as the leg moves forward be a positive, and a decreasing number be negative?
I'd really like to see if I can determine the signs in this fashion, set the string in the .ppr file (I suppose knowing the order in which they are stored in that file would help too), and output a NUKE sketch.
Lupulus, if you have a working v0013 that can output a .ppr file, can you try taking just the sign portion from it, and using it to set your v0015 .ppr file, loading the result into the NUKE editor and then outputting a sketch? That would at least be something.

escott76
05-31-2013, 08:44 PM
I very crudely hacked at v0013 to get things to run at least partially with the MX servos. Still a thing or three to sort out. I changed two different things, namely the size of the slider in the PoseEditor from 1023 to 4095, and then changed the angle to servo calc in lizard3.py to multiply by 25 instead of 100. I think I'm still missing something though.
The good news is that with these changes the Sign test does in fact start, and the legs snap to the positions that I set during the ikneutral. The sign test itself does not work as expected, the front left leg simply swings back and forth briefly for some of the checks, and nothing moves at all for others. Still it's progress in lieu of bizzare contortions.

escott76
06-01-2013, 07:36 PM
I was unable to get any further working with v0013 so again I started working with v0015. I added a few print statements in some strategic locations. During the sign test the bot would contort, and the contortion did not even follow the set limits. I even went so far as to set the limits very close to the neutrals to make sure of this. I added the print statements after calls to doIK to see that the pose calculated by doIK was correct.



def doSignTest(self,parent,step=0):
if step == 0:
print "Moving to neutral positions"
self["RIGHT_FRONT"] = [0,self.L_FEMUR+self.L_COXA,self.L_TIBIA]
self["RIGHT_REAR"] = [0,self.L_FEMUR+self.L_COXA,self.L_TIBIA]
self["LEFT_FRONT"] = [0,-self.L_FEMUR-self.L_COXA,self.L_TIBIA]
self["LEFT_REAR"] = [0,-self.L_FEMUR-self.L_COXA,self.L_TIBIA]
self["RIGHT_MIDDLE"] = [0,self.L_FEMUR+self.L_COXA,self.L_TIBIA]
self["LEFT_MIDDLE"] = [0,-self.L_FEMUR-self.L_COXA,self.L_TIBIA]
self.doIK()
print(self.nextPose[1:]) #Debug line
#parent.writePose(self.nextPose, 500)
parent.writePose(self.nextPose[1:], 500)
dlg = wx.MessageDialog(parent, "Click OK when ready!", 'Sign Test', wx.OK)
if dlg.ShowModal() == wx.ID_OK:
return self.doSignTest(parent,1)
else:
return "".join([self.strRep(t) for t in self.signs[1:]])
else:
msg = "" # message to display to user
servo = -1 # servo ID to reverse if we get a NCK
if step == 1:
# SET COXAS FIRST
self["RIGHT_FRONT"][0] = self.L_COXA/2
msg = "Did my RF leg move forward?"
servo = "RF Coxa"
elif step == 2:
self["LEFT_FRONT"][0] = self.L_COXA/2
msg = 'Did my LF leg move forward?'
servo = "LF Coxa"
elif step == 3:
self["RIGHT_REAR"][0] = -self.L_COXA/2
msg = 'Did my RR leg move backward?'
servo = "RR Coxa"
elif step == 4:
self["LEFT_REAR"][0] = -self.L_COXA/2
msg = 'Did my LR leg move backward?'
servo = "LR Coxa"
elif step == 5:
# Now FEMURs and TIBIAs
self["RIGHT_FRONT"][2] = self["RIGHT_FRONT"][2] - 20
msg = 'Did my RF leg move upward?'
servo = "RF Femur"
elif step == 6:
msg = 'Is my RF tibia still straight up and down?'
servo = "RF Tibia"
elif step == 7:
self["LEFT_FRONT"][2] = self["LEFT_FRONT"][2] - 20
msg = 'Did my LF leg move upward?'
servo = "LF Femur"
elif step == 8:
msg = 'Is my LF tibia still straight up and down?'
servo = "LF Tibia"
elif step == 9:
self["RIGHT_REAR"][2] = self["RIGHT_REAR"][2] - 20
msg = 'Did my RR leg move upward?'
servo = "RR Femur"
elif step == 10:
msg = 'Is my RR tibia still straight up and down?'
servo = "RR Tibia"
elif step == 11:
self["LEFT_REAR"][2] = self["LEFT_REAR"][2] - 20
msg = 'Did my LR leg move upward?'
servo = "LR Femur"
elif step == 12:
msg = 'Is my LR tibia still straight up and down?'
servo = "LR Tibia"
elif step == 13:
# middle legs
self["RIGHT_MIDDLE"][0] = self.L_COXA/2
msg = "Did my RM leg move forward?"
servo = "RM Coxa"
elif step == 14:
self["LEFT_MIDDLE"][0] = self.L_COXA/2
msg = "Did my LM leg move forward?"
servo = "LM Coxa"
elif step == 15:
self["RIGHT_MIDDLE"][2] = self["RIGHT_MIDDLE"][2] - 20
msg = 'Did my RM leg move upward?'
servo = "RM Femur"
elif step == 16:
msg = 'Is my RM tibia still straight up and down?'
servo = "RM Tibia"
elif step == 17:
self["LEFT_MIDDLE"][2] = self["LEFT_MIDDLE"][2] - 20
msg = 'Did my LM leg move upward?'
servo = "LM Femur"
elif step == 18:
msg = 'Is my LM tibia still straight up and down?'
servo = "LM Tibia"


# do IK and display dialog
self.doIK()
print(self.nextPose[1:]) #Debug line
#parent.writePose(self.nextPose, 500)
parent.writePose(self.nextPose[1:], 500)
dlg = wx.MessageDialog(parent, msg, 'Sign Test', wx.YES | wx.NO)
result = dlg.ShowModal()
if result == wx.ID_CANCEL:
return "".join([self.strRep(t) for t in self.signs[1:]])
elif result == wx.ID_NO:
print "Reversing", servo, "sign"
if self.signs[self.servos[servo]] > 0:
self.signs[self.servos[servo]] = -1
else:
self.signs[self.servos[servo]] = 1
self.doIK()
print(self.nextPose[1:]) #Debug line
#parent.writePose(self.nextPose, 500)
parent.writePose(self.nextPose[1:], 500)
if step < (3*self.legs):
return self.doSignTest(parent,step+1)
else:
return "".join([self.strRep(t) for t in self.signs[1:]])




This showed the pose that I wanted, but with a leading [512,]. In the code posted above I modified the


parent.writePose(self.nextPose, 500)

to this


parent.writePose(self.nextPose[1:], 500)

Now the right pose is output, and the bot actually goes to neutral for the beginning of the sign test. Again the actual sign test does not proceed correctly. Things might be moving in the correct directions, but it's difficult to say. The printed debug stuff is helpful, but things are only moving a few encoder counts. Even so, occasionally the left front coxa servo sometimes suddenly swings back and forth quickly.

tician
06-01-2013, 08:40 PM
Have you ever been getting any "LegIK FAILED" errors when you enable self.debug in lizard3? Might not be related, but it appears the legIK() function does not accommodate MX servos if it throws an exception ("return [1024,1024,1024,0]" are invalid values for AX/RX/EX, but valid for MX). Also curious where lizard3 updates the neutral positions for the 12-bit servos from the default 512 of AX servos.

There is a part of me that is also really curious, but extremely dense, about how lizard3 calculates the servo positions from radians. The AX/RX/EX servos have a useful range of 30~330 degrees (~300 degrees wide centered at 512) divided over 1024 position values. The MX servos have a full 360 degree range, so the conversion between angle (from 'zero') and goal position value differs a little bit more than just multiplying by 4. There were problems with DARwIn-OP users converting 10-bit motion sequences into 12-bit motion sequences because of that (motion files were only position values instead of angles from neutral).

AX => angle_from_zero_ticks (30 degrees from bottom center) ~ 30 + (300/1024)*(position_value)
AX => ticks_per_radian = ~195.67 => ~(radians*100/51)*100
MX => angle_from_zero_ticks (0 degrees from bottom center) ~ (360/4096)*(position_value)
MX => ticks_per_radian = ~652.23 =!= ~(radians*100/51)*25

escott76
06-01-2013, 08:56 PM
Have you ever been getting any "LegIK FAILED" errors when you enable self.debug in lizard3? Might not be related, but it appears the legIK() function does not accommodate MX servos if it throws an exception ("return [1024,1024,1024,0]" are invalid values for AX/RX/EX, but valid for MX). Also curious where lizard3 updates the neutral positions for the 12-bit servos from the default 512 of AX servos.

There is a part of me that is also really curious, but extremely dense, about how lizard3 calculates the servo positions from radians. The AX/RX/EX servos have a useful range of 30~330 degrees (~300 degrees wide centered at 512) divided over 1024 position values. The MX servos have a full 360 degree range, so the conversion between angle (from 'zero') and goal position value differs a little bit more than just multiplying by 4. There were problems with DARwIn-OP users converting 10-bit motion sequences into 12-bit motion sequences because of that (motion files were only position values instead of angles from neutral).

AX => angle_from_zero_ticks (30 degrees from bottom center) ~ 30 + (300/1024)*(position_value)
AX => ticks_per_radian = ~195.67 => ~(radians*100/51)*100
MX => angle_from_zero_ticks (0 degrees from bottom center) ~ (360/4096)*(position_value)
MX => ticks_per_radian = ~652.23 =!= ~(radians*100/51)*25

The difference is in the beginning of lizard3



# Convert radians to servo position offset.
def radToServo(rads, resolution = 1024):
if resolution == 4096:
val = (rads*100)/51 * 25;
return int(val)
else:
val = (rads*100)/51 * 100;
return int(val)


You make a very good point about the 300/360, this only seems to account for the difference in resolution.
And no, No "LegIK Failed" errors. I have been looking for them. I do currently get



Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff NOT found, restart: 80
Oxff NOT found, restart: 111
Oxff NOT found, restart: 115
Oxff NOT found, restart: 101
Oxff NOT found, restart: 58
Oxff NOT found, restart: 13
Oxff NOT found, restart: 10
Oxff found
Oxff found


and similar to these, but have not yet been able to track these down.

tician
06-01-2013, 09:42 PM
That is where it attempts to calculate the position offset from the neutral position (not sure that calculation is correct for 12-bit resolution), but I do not see any place where it actually changes the value of the neutral pose from 512 to 2048 based on the resolution (or updates from the captured neutral poses). Granted, I am not much of a python programmer and have not dug too deeply into the code.


The packet with ID==253 is the arbotix responding to commands from Pypose (only ever returns a status packet as if it received a ping). You would have to make pypose print out the TX packet to know what the arbotix is receiving.

escott76
06-01-2013, 10:15 PM
That is where it attempts to calculate the position offset from the neutral position (not sure that calculation is correct for 12-bit resolution), but I do not see any place where it actually changes the value of the neutral pose from 512 to 2048 based on the resolution (or updates from the captured neutral poses). Granted, I am not much of a python programmer and have not dug too deeply into the code.


No, that's not an offset from neutral, it is only a radians to servo ticks function. The offset is applied later during the IK stuff, here is an example :



def doIK(self):
fail = 0
req = [0,0,0,0] # [x,y,z,r]
gait = [0,0,0,0] # [x,y,z,r]
sol = [0,0,0] # [coxa,femur,tibia]


# right front leg
if self.gaitGen != None:
gait = self.gaitGen("RF_GAIT")
if self.debug:
print "RIGHT_FRONT: ", [self["RIGHT_FRONT"][i] + gait[i] for i in range(3)]
servo = self.servos["RF Coxa"]
req = self.bodyIK(self["RIGHT_FRONT"][0]+gait[0], self["RIGHT_FRONT"][1]+gait[1], self["RIGHT_FRONT"][2]+gait[2], self.X_COXA, self.Y_COXA, gait[3])
sol = self.legIK(self["RIGHT_FRONT"][0]+req[0]+gait[0],self["RIGHT_FRONT"][1]+req[1]+gait[1],self["RIGHT_FRONT"][2]+req[2]+gait[2], self.resolutions[servo])
output = self.neutrals[servo]+self.signs[servo]*sol[COXA]
if output < self.maxs[servo] and output > self.mins[servo]:
self.setNextPose(servo, output)
else:
if self.debug:
print "RF_COXA FAIL: ", output
fail = fail + 1
servo = self.servos["RF Femur"]
output = self.neutrals[servo]+self.signs[servo]*sol[FEMUR]
if output < self.maxs[servo] and output > self.mins[servo]:
self.setNextPose(servo, output)
else:
if self.debug:
print "RF_FEMUR FAIL: ", output
fail = fail + 1
servo = self.servos["RF Tibia"]
output = self.neutrals[servo]+self.signs[servo]*sol[TIBIA]
if output < self.maxs[servo] and output > self.mins[servo]:
self.setNextPose(servo, output)
else:
if self.debug:
print "RF_TIBIA FAIL: ",output
fail = fail + 1




The "output =" portions take the neutral position and modify it based on the current leg and body IK. During the sign test at the beginning you are trying to get to the neutral position, and there is no IK offset so they go to the position set by ikneutral pose. At least that's the way that I think it works.

tician
06-01-2013, 11:11 PM
# Convert radians to servo position offset.
def radToServo(rads, resolution = 1024):
if resolution == 4096:
val = (rads*100)/51 * 25;
return int(val)
else:
val = (rads*100)/51 * 100;
return int(val)

Converts an angle offset (in radians) from the 'neutral' angle (0.0; default of 512 on AX; default 2048 on MX) into an offset in encoder ticks. It does not know the neutral angle, but it is used to calculate an offset of encoder ticks from the neutral position (the angles calculated during legIK are an offset from neutral).




def configModel(self):
""" Load the model for our IK solution. """
modelClassName = iKmodels[self.ikChoice].folder
if "tools/models/"+modelClassName not in sys.path:
sys.path.append("tools/models/"+modelClassName)
modelModule = __import__(modelClassName, globals(), locals(), [modelClassName])
modelClass = getattr(modelModule, modelClassName)
# make instance
model = modelClass(int(self.optChoice),True) # dofORlegs/debug/GaitGen
model.config( [int(v.GetValue()) for v in self.vars], [int(s.GetValue()) for s in self.servos])
model.mins = [512,] + self.parent.project.poses["ik_min"]
model.maxs = [512,] + self.parent.project.poses["ik_max"]
model.resolution = [1024,] + self.parent.project.resolution
model.neutrals = [512,] + self.parent.project.poses["ik_neutral"]
model.signs = [1,] + [1+(-2*(t=="-")) for t in self.signs]
self.model = model

I am curious where this function in NukeEditor is ever called. It looks like this is where/how the lizard3 model is supposed to get everything updated with the user entered values, but I cannot find the function call anywhere. The only other places I can find "ik_neutral" are in the doNeutral() and doExport() functions, which do not change the neutral values used by the model, do they? I see signs and servos modified during the loadData()...

Should the call to loadModel() in doSignTest() be a call to configModel()? Nevermind, it appears to be correctly calling configModel() in the svn on google code revs:661 and 660 and in the most recent version on github, but not in arbotix-0015 or rev. 574. Probably a big source of the problem that fergs has fixed, just not updated the 0015 download yet.


def doSignTest(self, e=None):
""" Do the sign test, let's hope we pass. This is handled by the model. """
if self.doChecks(["project","port","ik"]) > 0:
self.loadModel()
self.signs = self.model.doSignTest(self)
self.save()

escott76
06-02-2013, 09:55 AM
The questions you are asking are the same ones I was asking myself a few days ago. Here is where my logic is currently :

I know that a previous version of this software was known to work with at least one bot using AX servos. This is v0013. The newest freshest from Github does not work with the same robot. I cannot use v0013 as it does not support the MX servos. I have compared all the IK stuff from v0013 to v0015 and found them to be pretty close to identical, with the exception that the newer one has a resolution argument which is passed to the radtoservo function. I take this to mean that the IK section of the newer code is sound, and calculating the correct things.
The problem of having the robot contort wildly can be traced to happening in a specific place, as you can open the Nuke Editor, and do everything fine except the sign test. The robot contorts right after the sign test, before you click "ok" in the dialog that pops up. So you can isolate the section of code that it happens in. Line 450 of liard3.py is the only line that causes movement


parent.writePose(self.nextPose, 500)


Adding a print statement before this line shows that the pose about to be output is 13 elements long (for 12 servos) and starts with 512, i.e.:
[512, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048] but instead of 2048, they are the correct numbers for the captured neutral position. From this we can infer that the model is configured correctly, and that the ikneutral pose was brought over and set up in the model. The 'default' values for neutral have been overwritten and mean nothing.
In what is likely a poor attempt to rectify the problem I changed the above code to read :


parent.writePose(self.nextPose[1:], 500)

in order to get rid of the leading [512,]. I did this for about 3 instances of this line in the signtest function. Now instead of contorting the robot moves to the neutral position when it says it will. Great! But the sign test does not run correctly. There is a small amount of movement commanded to a few of the legs, but since there are 4096 counts, 10 or so counts of commanded motion is hard to see. I have been looking at the debug printouts of pose that I added to tell, and comparing these numbers to try to answer the sign test questions. This part may be better on an AX bot now though, as the lower resolution would show things more, but I think there is more going on here.
I had managed to modify v0013 to work with the MX servos by changing a few obvious things to increase the limits on the servo and modify the radtoservo function. The sign test behaved identically here, moving to neutral correctly and then not showing much movements. This part is known to work right on the AX servos, so this could be linked to that change.
I am next interested as to how that leading number got inserted into the pose, and why.

tician
06-02-2013, 10:17 AM
The leading [512,] and [1024,] are added in configModel() because it does not check for servo resolution before creating the array.

Just for the hell of it, try changing the radToServo function for 4096. The number of encoder ticks should be ~4 times larger per radian than the AX, not ~1/4 per radian.


# Convert radians to servo position offset.
def radToServo(rads, resolution = 1024):
if resolution == 4096:
val = (rads*150)/23 * 100;
# val = (rads*100)/51 * 25;
return int(val)
else:
val = (rads*100)/51 * 100;
return int(val)

escott76
06-02-2013, 12:55 PM
The leading [512,] and [1024,] are added in configModel() because it does not check for servo resolution before creating the array.

Just for the hell of it, try changing the radToServo function for 4096. The number of encoder ticks should be ~4 times larger per radian than the AX, not ~1/4 per radian.


# Convert radians to servo position offset.
def radToServo(rads, resolution = 1024):
if resolution == 4096:
val = (rads*150)/23 * 100;
# val = (rads*100)/51 * 25;
return int(val)
else:
val = (rads*100)/51 * 100;
return int(val)



This helps and allows completion of the sign test. I have a feeling that this error is carried over into the sketch that is exported, as when I fire up the test drive I can get the body to pitch and pan, but only slightly. Walking forward is not working with the sketch I have exported at this time.
Thanks for your help!

tician
06-02-2013, 01:03 PM
models/core/nuke.cpp


/* Convert radians to servo position offset. */
int radToServo(float rads){
float val = (rads*100)/51 * @RAD_TO_SERVO_RESOLUTION;
return (int) val;
}


Scratch that. NukeEditor.py line ~510 in doExport()


elif self.parent.project.resolution[0] == 4096:
params["@RAD_TO_SERVO_RESOLUTION"] = str(25)
[code]
change to:
[code]
elif self.parent.project.resolution[0] == 4096:
params["@RAD_TO_SERVO_RESOLUTION"] = str(333)
[code]



Old:
Not sure how the source gets modified, but hard-coding the "val" equation should be a temporary work-around.
[code]
float val = (rads*150)/23 * 100;

...or use another approximation without modifying the rest of the equation


float val = (rads*100)/51 * 333;

escott76
06-02-2013, 01:14 PM
Sure enough, the same error is carried over to the exported sketch. The same correction results in the correct behavior!
Woohoo!
Now for some tuning...

Lupulus
06-03-2013, 02:04 PM
Congrats, Escott! You and Tician did some nice work there :happy:
Which operating system did you end up using?

escott76
06-03-2013, 03:09 PM
I've been running with an Ubuntu 11.04 install under Parallels. It was the "most current" before I updated my Parallels install, now they would have me dl 12. I was honestly just being lazy, they have pre-built images to run under the VM.
I don't see why the same changes would not work in any other OS though, but I will do some more testing.

lnxfergy
06-05-2013, 12:24 AM
Oh man. Just logged into the forum for the first time in about a week, and found this thread. Nice work on tracking down these bugs. I'll try to get them merged into the repo soon.

-Fergs

lnxfergy
06-05-2013, 12:48 AM
And I guess I feel compelled to give just a bit of backstory on why this is broken. Sometime around 2010, (after the v0013 release) I started rewriting the backend to make it possible to support other IK models (especially the biped model). I eventually got busy with other things, and never really finished it. When the MX servos came out, we did some quick testing and pushed a new release... sorry about that.

Anyways, I just finished adding your changes to the repo. Now to kill that 0015 download and point people at the github zip.

Again, big thanks for posting back how you fixed the problems!

-Fergs

P.S. there is nothing quite like reading code you wrote years ago to really make you cringe....