Hi,
I have been experimenting with M4 in Sim and discovered a few useful things.
First is that if you go to the Configure/Mach/Axis Mapping tab and even if you change nothing as you click OK then those
settings are made. I have tried:
mcAxisEnable(inst,0,true); it as expected enables/disables axis 0 in this example,
mc.mcAxisUnmapMotors(inst,0); it unmaps all motors from axis 0 in this example,
mc.mcAxisMapMotor(inst,0,0); it maps motor0 to axis0 in this example;
mc.mcAxisMapMotor(inst,0,4); it maps motor4 to the axis0, and this is the kicker now two motors are mapped to axis 0 exactly as Cal requires
and can be temporarily undone by:
mc.mcAxisUnmapMotor(inst,0,4); there again as Cal requires. Under this circumstance motor 0 is still mapped and could be jogged/MDI'ed into position
and then motor4 could again be slaved back to motor0. Don't bother to go to the Configure/Mach/Axis Mapping tab it won't reflect your hand coded
mappings/unmappings and worse will overwrite them just to screw with your head!.....Go on...tell me you didn't go there to try for yourself and now
all your mappings are up the duff right, I bloody told you!
I have been observing the results of various experiments with the sim diagnostic pinned to be always on top, really useful. The reason I chose motor4
rather than motor3, the next spare one, is that the velocity trace which should be solid black doesn't show up whereas all the others do. The string of
position data in the pane above suggests that motor3 is moving as anticipated just that the velocity trace doesn't show, a bug maybe.
What I propose is that if Cal were to write a macro it would in the first instance read ALL the existing enable states and mappings. Then home all axes,
uncouple the master/slave pair, jiggle the remaining motor until square and recouple. Then as an important last before exiting the macro restore
ALL the enable states and mappings to avoid having some hapless operator go to the Configure/Mach/Axis Mappings tab and inadvertently change
everything.
I am still of the opinion when you set up your controller that the two motors would have to be assigned independent 'channels'. The experimenting
I've done suggests that it is possible to have Machs core run the master/slave assignments and they can programmatically be manipulated. This would
obviate the need for the motion controller plugin to handle squaring. A good result I think!
Craig