Mori Seiki TV30 tool changer help needed

More
18 Oct 2020 19:42 #186490 by Varang1an
Hi
I have Mori Seiki TV30 with 10 tool carousel and it is being driven by servomotor (all the drives are mitsubishi MDS-A-SVJ type and I can have battery packed ABS position for even toolchanger servo... The gearing setup in servo parameters is done so that one "step" instruction moves the carousel forward or backward exactly one pocket so example when I set my toolchanger servo as joint_4 and axis_A i could drive it one degree forward and got next tool in place.

Now I would like to know how I could set it up properly so that example when I am in tool no 10 and select tool no 1 it would just directly rotate shortest way to no 1 instead of rotating back from 10 to 1. I don't know if that made any sense to anyone? but any help would be appreciated. Also what would be best way to set this up properly without using A axis for this as it may interfere with plans to add later rotary axis.

Regards
Tero

Please Log in or Create an account to join the conversation.

More
19 Oct 2020 03:06 - 19 Oct 2020 03:13 #186546 by dm17ry
i'd write a HAL component in C for that. no need to create a joint or an axis - command the servo position directly via limit3. you have position feedback from the servo, so you always know where the umbrella is. add required sanity checks and interlocks, like verifying if the position is within pocket tolerance or servo zero-speed and at-position signals are true before signalling "ready" downstream...

as for choosing the shortest move direction - well, just do it. assuming motor position 0.0 (or 10.0 and so on) is the 1st pocket, 9.0 is the 10th, something like that comes to mind

int current_pocket = round(motor_pos_fb) % 10;
if (current_pocket < 0) current_pocket += 10; // make it 0..9
int move_dist = new_pocket - current_pocket;
if (move_dist > 5)
	move_dist -= 10; // go back instead
else if (move_dist < -5)
	move_dist += 10; // go forward
else if (move_dist == 5 or move_dist == -5) // can move either way
	move_dist = motor_pos_fb > 0 : -5 : 5; // go towards the origin

double new_motor_pos = round(motor_pos_fb) + move_dist;
Last edit: 19 Oct 2020 03:13 by dm17ry.

Please Log in or Create an account to join the conversation.

More
19 Oct 2020 11:13 - 19 Oct 2020 11:48 #186567 by Varang1an
Ok so what would the limit do? I would set min and max coordinates for it based on tool requested and then drive servo based on it?

Making C hal component would make sense yes, and programming C is ok with me, but the issue is I don't have idea how to pass values back and forth. Is it just as simple as to write
pin in int pocket;
pin out bit tool_changed;
etc...

or could I drive servo directly inside C? and if yes how I could do it? is there a way to access those hal functions like nyx.0.servo-AX.pos-cmd
Last edit: 19 Oct 2020 11:48 by Varang1an.

Please Log in or Create an account to join the conversation.

More
19 Oct 2020 12:19 - 19 Oct 2020 12:20 #186574 by dm17ry
the limit3 component takes a changing target position and output it limiting its rate of change so that its speed and acceleration stay within defined limits.
linuxcnc.org/docs/html/man/man9/limit3.9.html

basically yes, it's that simple. you input the integer pocket no, and output servo position and some status signals. passing position command thru limit3 will allow you to change it instantly, e.g.
component utc;
pin in signed pocket;
pin in float tc-pos-fb;
pin out float tc-pos-cmd;
pin out bit ready;
function _;
;;
tc_pos_cmd = pocket * 10.0; // e.g. 10 units between pockets
ready = fabs(tc_pos_cmd - tc_pos_fb) < 0.01;

and then connect your component externally:
loadrt utc
loadrt limit3
addf utc.0 servo-thread
addf limit3.0 servo-thread

net tc-pos-fb utc.0.tc-pos-fb <= nyx.0.servo-03.pos-fb
net tc-pos-cmd utc.0.tc-pos-cmd => limit3.0.in
net tc-pos-cmd-limited limit3.0.out => nyx.0.servo-03.pos-cmd
setp limit3.maxv 10.0
setp limit3.maxa 0.1

it's simplified, but i guess you've got the idea... and read the HAL tutorial
Last edit: 19 Oct 2020 12:20 by dm17ry.

Please Log in or Create an account to join the conversation.

More
19 Oct 2020 12:50 #186578 by Varang1an
Great, thank you I will proceed and build component for this and see what happens.

Please Log in or Create an account to join the conversation.

More
27 Oct 2020 12:02 - 27 Oct 2020 12:02 #187403 by Varang1an
Ok I can't get my code to work at all...
component tv30atc;
pin in signed req_pocket;
pin in float tc_pos_fb;
pin out float tc_pos_cmd;
pin out float ready;
license "GPL"; // indicates GPL v2 or later
function _;
;;
#include <math.h>
int move_dist;
int current_pocket = round(tc_pos_fb); // current pocket is rounded position of motor
if (current_pocket < 10) {
	current_pocket += 10; // make it 0..9
	move_dist = req_pocket - current_pocket;
}
if (current_pocket >= 10) {
	current_pocket -= 10;
	move_dist = req_pocket - current_pocket;
}
if (move_dist > 5) {
	move_dist -= 10; // go back instead
}
else if (move_dist < -5) {
	move_dist += 10; // go forward
}
else if (move_dist == 5 && tc_pos_fb > 0) { // can move either way
	move_dist = tc_pos_fb -5; // go towards the origin
}
else if (move_dist == -5 && tc_pos_fb > 0) {
	move_dist = tc_pos_fb +5;
}
tc_pos_cmd = tc_pos_fb + move_dist;
ready = fabs(current_pocket - tc_pos_fb) < 0.01; // when tc position near motor feedback position then signal ready

I get error from line 11 (int current_pocket = round(tc_pos_fb) and the error is "__comp_get_data_size used but never defined staic int __compt_get_data_size(void);"
Last edit: 27 Oct 2020 12:02 by Varang1an.

Please Log in or Create an account to join the conversation.

More
04 Nov 2020 11:29 #188303 by Varang1an
Ok got it to compile and did lot of changes etc... and still have some bugs to iron out, but finally I am getting there to get this toolchanger to work ::silly: I have had to run it hand all the time at emergency stop as wrong moves etc could destroy whole carousel :laugh:

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds
Powered by Kunena Forum