JIANGYUFEI / arbotix

Automatically exported from code.google.com/p/arbotix
0 stars 0 forks source link

Incorrect order in servo_layout map in tools/models/lizard3/lizard3.py makes NukeEditor fail. (+patch) #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build PhantomX Hexapod.
2. Load PyPose and run the "NUKE editor".
3. Assign servos to the labeled locations.
4. Capture limits and neutral poses. 
   To easily see the issue, create the ik_neutral pose with all values  512, except for corner COXA servos. 
e.g. 
Pose=ik_neutral:674, 350, 512, 512, 512, 512, 350,674, 512, 512, 512, 512, 512, 
512, 512, 512, 512, 512

5. Export firmware.
6. Load firmware onto robot. (may have to comment out "#include <WProgram.h>" 
in nuke.cpp Arduino 1.0.1 environment.)

What is the expected output? 

The center coxa servos should point straight out, the corner ones will not 
align correctly due to incorrect signs, and all other servos will be at similar 
angles.

What do you see instead?

The servo alignments do not apear as described. The left middle servo is not 
correctly positioned.

What version of the product are you using? On what operating system?

PyPose-0015.zip from http://code.google.com/p/arbotix/downloads/list

On Ubuntu 12.04

Please provide any additional information below.

The servo_layout map in tools/models/lizard3/lizard3.py does not specify the 
same ordering as the NukeEditor export function. It interleaves left and right 
servos, instead of the current "leg at a time" order. This mismatch results in 
the labels being incorrectly assigned in the interface, compared to how the 
servo indexes are used internally.

The patch below allows the expected behavior to occur. (Additional minor patch 
to NukeEditor changes view to three column, is t not included. ) After applying 
this patch the robot's initial pose is as expected. (The signs must be manually 
adjusted in project file though; see Issue 30.) 

--- pypose-0015/tools/models/lizard3/lizard3.py 2012-10-01 11:30:55.000000000 
-0400
+++ pypose-patched/tools/models/lizard3/lizard3.py      2012-10-03 
09:03:11.742890411 -0400
@@ -67,7 +67,7 @@
         self.vars = { 0:["Coxa(mm)",50],1:["Femur(mm)",50],2:["Tibia(mm)",50],3:["X(mm)",50],4:["Y(mm)",50],5:["Mid-Y(mm)",50],6:["X(mm)",0],7:["Y(mm)",0] }

         # Column 3 = Servo Values, need both specification of layout and data. 
-        self.servo_layout = ["LF Coxa","RF Coxa","LF Femur","RF Femur","LF 
Tibia","RF Tibia","","","LM Coxa","RM Coxa","LM Femur","RM Femur","LM 
Tibia","RM Tibia","","","LR Coxa","RR Coxa","LR Femur","RR Femur","LR 
Tibia","RR Tibia"]
+        self.servo_layout = ["LF Coxa","LF Femur","LF Tibia","RF Coxa","RF 
Femur","RF Tibia","","","","LM Coxa","LM Femur","LM Tibia","RM Coxa","RM 
Femur","RM Tibia","","","","LR Coxa","LR Femur","LR Tibia","RR Coxa","RR 
Femur","RR Tibia"]
         self.servos = { "RF Coxa":1, "RF Femur":3, "RF Tibia":5, "LF Coxa":2,"LF Femur": 4,"LF Tibia":6,"RR Coxa":7, "RR Femur":9, "RR Tibia":11, "LR Coxa":8, "LR Femur":10, "LR Tibia":12, "RM Coxa":13,"RM Femur":15,"RM Tibia":17,"LM Coxa":14,"LM Femur":16, "LM Tibia":18}

Original issue reported on code.google.com by zenith.p...@gmail.com on 3 Oct 2012 at 1:39

GoogleCodeExporter commented 9 years ago
This got past testing because my hexapod happens to have the servos set up as 
the old defaults. Rather than change the servo_layout, I've added an 
appropriate update to NukeEditor that uses the servo_layout to properly access 
servos.

Original comment by MFergs7@gmail.com on 14 Oct 2012 at 8:30