Welcome! Log In Create A New Profile

Advanced

Marlin code for scissor lift z-axis

Posted by OoiTY 
Marlin code for scissor lift z-axis
February 22, 2014 04:06AM
I'm trying to figure out where in marlin I might modify the Z axis so that it follows a non-linear path for a scissor lift. The formula is quite simple and thanks to wolfmanjm's help in the IRC channel, I think I figured out what I should change.



The formula that needs to be plugged in is above, and in Marlin's planner.cpp, there are these few lines below;

 // The target position of the tool in absolute steps
  // Calculate target position in absolute steps
  //this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
  long target[4];
  target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
  target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
  target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]); 
  target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);

Since I have no idea on how to code properly, is there anyone who can help me with the proper syntax for the formula above?

My own rough attempt results in something like this;

  target[Z_AXIS] = 1round(sqrt((sq(Scissor_arm_length)-sq(y*axis_steps_per_unit[Z-AXIS])));

Can anyone help me with this little coding problem?

Edited 1 time(s). Last edit at 02/22/2014 05:46AM by OoiTY.
Re: Marlin code for scissor lift z-axis
February 25, 2014 01:42AM
I don't think theres a sq() function in C. Also, don't you mean z instead of y?
I think it should be something like...
float c = z*axis_steps_per_unit[Z-AXIS];
target[Z_AXIS] = lround( sqrt( Scissor_arm_length*Scissor_arm_length - c*c ) );


In addition, you might want to look at this or this as examples on how to modify the firmware for nonlinear motion.
Re: Marlin code for scissor lift z-axis
February 27, 2014 02:06AM
Thanks! That looks pretty good, I couldn't figure out how to plug in the current position of (b) into the code, but that looks like how it should work. I'll test it out later to see if it works. smiling smiley
Re: Marlin code for scissor lift z-axis
April 04, 2014 07:36PM
Any more work being done on this?


--------------------------------------------------------
Custom all metal CoreXY
- Duet 2 Wifi w/ PanelDue 7i
- 330mm x 360mm x 500mm
- 750w Silicon heater

Custom Mendel90
(Backup printer - Old reliable!) - Sold
Re: Marlin code for scissor lift z-axis
December 17, 2014 09:06PM
I'm looking into using a lab jack as a z axis on a printer, did anyone have any luck modifying Marlin to compensate for non linear scissor lift mechanics?
Re: Marlin code for scissor lift z-axis
December 31, 2014 08:48PM
Just a thought — it might be better to use a Gcode preprocessor instead. Just modify the coordinates depending on the Z-height.
Re: Marlin code for scissor lift z-axis
April 12, 2015 06:42AM
Has anyone done ? Experiences,..
I will use tabel at
[reprap.org]

Experience whit g-code solution or firmware change
welcome.

This bit more comlicate, there must 4 point vompensation done at
difrent heights. So hacking must be done compoensation code ???

Better idea's ?
Re: Marlin code for scissor lift z-axis
January 11, 2017 05:07PM
Hi there, I have same plan. To create a scissor bed.
I don't know if you had progress in you idea.
But maybe I can write a conversor in PHP and put it online.
Let me know if you have interest yet.

Thanks
Sorry, only registered users may post in this forum.

Click here to login