2012/8/28 Todd                      Zuercher <zuerc...@embarqmail.com>:
>
> When you say the positions should match, is matching just in local 
> coordinates (including offsets) good enough or does it have to be machine 
> coordinates that match (the latter really wouldn't be much use).  If the 
> local coordinates and tool offsets applied to W aren't maintained through the 
> swap to ZZ mode, this won't do me a whole lot of good.
>

I think that I have figured this out:
In kinematics module insert some "offset" between pos->w and joint[8] like this:
in inverse kins:
joints[8] = pos->w - offset;
in forward kins:
pos->w = joints[8] + offset;

You will need to add some lines to make that "offset" as a HAL pin.
In the beginning, right after all the #INCLUDE lines:

struct haldata_t {
   hal_float_t *offset;

} *haldata = 0;

#define offset (*(haldata->offset))


And then in the end (please note that some of the first lines of the
following block are already there, but I copied them all so that it
makes easier to understand, where to place all it; BTW I named it
"swapkins" just for example purposes):

static int comp_id;
int rtapi_app_main(void) {
   int result;
   comp_id = hal_init("swapkins");
   if(comp_id < 0)
   return comp_id;

   haldata = hal_malloc(sizeof(struct haldata_t));

   result = hal_pin_float_new("swapkins.offset", HAL_IN,
                              &(haldata->offset), comp_id);
   if(result < 0) goto error;

   hal_ready(comp_id);
   return 0;

error:
   hal_exit(comp_id);
   return result;
}

void rtapi_app_exit(void) { hal_exit(comp_id); }



So in HAL You should have swapkins.offset pin, and any value You feed
in to this pin, will be subtracted from W position to get the joint[8]
position. Nice way to test it out is connecting this pin to scale or
spinbox vcp widget and change the value and check, if the joint moves
accordingly.

Few more things in HAL are needed to link joint[8] to Z movements.
There is sample_hold HAL component. I see that it has s_32 inputs and
outputs, so You will need to change them to float - open the source
file in /src/hal/components/, save with different name and change
"s32" to "float", save again (I will use "sample_hold_float" as an
example) and then build that component.

In HAL You will need to make following connections (syntax not
complete and correct here):
axis.2.joint-pos-cmd => sample_hold_float-in
motion.digital-out-00 => sample_hold_float-hold
sample_hold_float-out => sum2-in0
axis.2.joint-pos-cmd => sum2-in1
sum2-out => swapkins.offset

setp sum2-gain0 1
setp sum2-gain1 -1



In the end it _should_ work like this:
1) drive Z and W to their desired positions ("swap-point"), which is
free of Your choice;
2) issue M62 P00 in g-code
3) run the code, joint[8] should move for the same amount from
"swap-point" as joint[2];
4) drive Z back to "swap-point";
5) issue M63 P00 in g-code

This way all the offsets applied to W should remain effective. And
also any W commands during the "swapped phase" will also be reflected
in joint[8] position, so that is a way to introduce some offset
between joint[2] and joint[8], if needed.

Let me know, if You will try this and how it actually works.

-- 
Viesturs

If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to