Hello Guest it is May 25, 2025, 04:21:10 PM

Author Topic: Mach4 Absolute Positioning with Mitsubishi MR-J3  (Read 4949 times)

0 Members and 2 Guests are viewing this topic.

Mach4 Absolute Positioning with Mitsubishi MR-J3
« on: October 29, 2024, 03:28:42 AM »
Hello, i've finally get my machine syncronizing the absolute position with my servo drives Mitsubishi MR-J3  8)
It took a lot of time but now at restarting the machine it's syncronized and squared correctly :)

Basically this is the working:
1- When the estop signal disapears it enable mach and waits some time to initialize the drives (my spindle tooks 2 seconds to initialize)
2 -Save the current machine position to some variable for later return to it
3- Asks the abs position to the servodrives (using a rs422 link)
4- Converts the position in units to machine units
5- Deactivate the soft limits
6- Calculate the difference between the actual position and the abs position
7- Locks the servodrives to avoid motors movement (i've got that disabling the servo limits signals)
8- Asign the slave axis to a unused axis to move it individually (because i have a gantry machine)
9- Command the software to move the distance required to go to the actual position (because you can't tell to mach4 to overwrite the machine position)
10- Unlock the servodrives to enable the motors movement
11- Move the slave axis to the corrected position (master Axis position + YOffset to square the machine)
12- Re assign the slave axis to the master Axis and enable it
13- Move the machine to the old position

Maybe would be some ways improve this, if you knows some please let me know.
I've attached the code if someone wants to try to implement it.
Thanks

Offline Bill_O

*
  •  598 598
Re: Mach4 Absolute Positioning with Mitsubishi MR-J3
« Reply #1 on: October 29, 2024, 10:56:21 AM »
Nice job.

Offline cncmagic

*
  •  109 109
  • what me worry? heck...it ain't my machine anyway
Re: Mach4 Absolute Positioning with Mitsubishi MR-J3
« Reply #2 on: October 31, 2024, 11:33:25 PM »
might be nice.. except I can't figure out exactly what the heck you're doing... or why... and I'd guess nearly everyone else is in the same boat... and whomever said 'nice job'.. he's either a hell of a lot smarter than I am or simply feels like a certain Coyote after the dynamite explodes...  :o
any semblance of information posted to anything remotely  close to accuracy is merely coincidence. Use at you own discretion.. or play the lottery.. same odds

Offline Bill_O

*
  •  598 598
Re: Mach4 Absolute Positioning with Mitsubishi MR-J3
« Reply #3 on: November 01, 2024, 08:18:45 AM »
lol
I dont get some of the com stuff but the rest is a nice programing job.

Offline cncmagic

*
  •  109 109
  • what me worry? heck...it ain't my machine anyway
Re: Mach4 Absolute Positioning with Mitsubishi MR-J3
« Reply #4 on: November 01, 2024, 03:08:19 PM »
could be ... or might not be such a good programming job.. I didn't take that much time in reviewing.. but that said, before you can actually review something, you need to know what the scope is, and unless you're giving a class on programming, where syntax and structure count, you also need to understand what the problem is, and what the solution was. I can write lots of code which would be syntactically correct, and have good structure, and did nothing relevant to any actual problem..  or fixed an issue with lots of coding and involvement of time and effort, that could have been much more easily rectified.
I fail to understand what his reference to 'Absolute' is.. but I would agree that he is in absolutely the position he believes he's in.  :o
any semblance of information posted to anything remotely  close to accuracy is merely coincidence. Use at you own discretion.. or play the lottery.. same odds

Offline Bill_O

*
  •  598 598
Re: Mach4 Absolute Positioning with Mitsubishi MR-J3
« Reply #5 on: November 04, 2024, 08:38:29 AM »
Yea, i know complimenting someone for making a nice program is terible if i do not actually run it.
My bad

Offline cncmagic

*
  •  109 109
  • what me worry? heck...it ain't my machine anyway
Re: Mach4 Absolute Positioning with Mitsubishi MR-J3
« Reply #6 on: November 04, 2024, 09:19:22 AM »
no.. there would be a lot of programs that I would compliment even if I didn't run them.. if there was some issue that could be either documented or described, and then the problem submitted, I could then possibly make some determination that this was a way to resolve it. As opposed to "I had a problem turning my coolant pump on in my Gcode', so I wrote a macro that sets variables that I read in my custom PMC coding, then set the state of mach to enabled, then another macro reads that the variables are set and mach is enabled, and changes the PMC code being executed that now turns on the coolant.. might be nice code... why simply not use 'M8'? or hook your pump to any other output on whatever io module you have, and turn that on..
the biggest issue I have here is that I'm not quite sure what kind of issue he's resolving.. If he knows what his position is already, what's all the coding for? you can readily set your position.. if his servo's have absolute encoders (that's actually an unusual combination) and he reads their position and then sets Mach4's position, what does he need to memorize his last location for?
and even better... I've mucked about in Mach4 now for a bit.. and Mach3 previously.. and from what I've encountered, and from what I see in the forum, less is very much better than more.. Mach4 has all sorts of strange, undocumented issues even left alone.. placing all sorts of custom coding into it doesn't make it much better.. and often leads to really strange things happening.. while I am impressed with some of the applications I've read here, I'm really amazed that a lot of them actually worked.. and from an industrial perspective there are in many instances really much simpler and easier fixes to a lot of the issues. If time and effort don't matter, than fine.. try and modify Mach4 as much as you possibly can.. that's not money... that's a hobby... I unfortunately don't have that luxury.  :o
any semblance of information posted to anything remotely  close to accuracy is merely coincidence. Use at you own discretion.. or play the lottery.. same odds