MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.03k stars 19.13k forks source link

[FR] Delta robot kinematics (rotary) #25617

Open ubertidavide opened 1 year ago

ubertidavide commented 1 year ago

Is your feature request related to a problem? Please describe.

I'm searching for a firmware that support delta robot kinematics like that described in this paper: https://hypertriangle.com/~alex/delta-robot-tutorial/

In this firwmare i find delta kinematics code, but i think is the delta kinematics used in 3d printer that have scrolling z axis and it work in a different way than the arm in this paper.

Are you looking for hardware support?

No response

Describe the feature you want

If it's possible to implement this kind of kinematics in the firmware as additional feature with custom delta robot arm, because on the internet i saw that is becoming popular this kind of tools, and enable the possibility to create custom delta robot using a configured marlin firmware could be very interesting also for 3d printing. I am not experienced with the Marlin framework itself and i don't know how to start to do that at this moment... Thanks.

Additional context

No response

ariankhatb commented 1 year ago

I have just started the process of converting my Ender 3 to a Delta robot with goal of eventually turning it into a 3d printer. I'm also in the same boat as you, not have much knowledge of the firmware, and would like to implement the kinematics.

ariankhatb commented 1 year ago

@ubertidavide maybe we can start this and figure out the kinematics ourselves I've looked everywhere and the best choice it to use smoothieware as most other people doing this have done but how hard could it be?

ariankhatb commented 1 year ago

This is as far i got with this so far, t doesn't work but staring point

// rotary_delta.h
#pragma once

class RotaryDeltaKinematics {
public:
  // Constructor
  RotaryDeltaKinematics(float p0, float p1, float p2, float p3);

  // Move to a specific Cartesian position (x, y, z)
  void moveTo(float x, float y, float z);

private:
  // Calculate the lever angle based on the desired position (x, y, z)
  float leverCalc(float x, float y, float z) const;

  // Geometric parameters of the rotary delta printer
  float p0_;
  float p1_;
  float p2_;
  float p3_;
};

// rotary_delta.cpp
#include "rotary_delta.h"
#include <cmath>

// Constants
constexpr float PI = 3.14159265358979323846;

// Constructor implementation
RotaryDeltaKinematics::RotaryDeltaKinematics(float p0, float p1, float p2, float p3)
  : p0_(p0), p1_(p1), p2_(p2), p3_(p3) {}

// Move to a specific Cartesian position (x, y, z)
void RotaryDeltaKinematics::moveTo(float x, float y, float z) {
  // Calculate lever angles for each arm
  float front = leverCalc(x, y, z);
  float ry = -y * sin(PI / 6) + x * cos(PI / 6);
  float rx = -y * cos(PI / 6) - x * sin(PI / 6);
  float right = leverCalc(rx, ry, z);
  float ly = -y * sin(PI / 6) - x * cos(PI / 6);
  float lx = y * cos(PI / 6) - x * sin(PI / 6);
  float left = leverCalc(lx, ly, z);

  // Set the levers to the calculated angles
  // This part is printer-specific and may require additional code to control the servos or motors
  setLevers(front, left, right);
}

// Calculate the lever angle based on the desired position (x, y, z)
float RotaryDeltaKinematics::leverCalc(float x, float y, float z) const {
  float mp2 = sqrt(pow(p2_, 2) - pow(x, 2));
  y = y + p3_ - p0_;
  float h = sqrt(pow(y, 2) + pow(z, 2));
  float theta = atan(y / z) + acos((pow(h, 2) + pow(p1_, 2) - pow(mp2, 2)) / (2 * h * p1_));
  theta = theta / PI * 180; // Convert to degrees
  return theta;
}

// Additional function to set the levers to the calculated angles
// This function is printer-specific and may require additional code to control the servos or motors
void setLevers(float front, float left, float right) {
  // Implement servo/motor control code here
  // ...
}
ubertidavide commented 1 year ago

@ariankhatb i have the code that DeltaX released as open source in it's repository https://github.com/deltaxrobot/Delta-X-Firmware/blob/master/Delta_Firmware/DeltaKinematics.cpp, this is a delta robot and whatching the robot in videos it run smoother, but at this time i'm not able to modify the firmware to add that kinematics.

ariankhatb commented 1 year ago

Thanks, ill check and it try to implement it as I find time!

Graylag-PD commented 1 year ago

Guys, I have built my own rotary delta years ago including coding, so I am happy to help. But have you thought about the practical aspects of this? There is a good reason why rotary deltas never made it into 3D printing world and that is they are essentially worthless unless you use very expensive strain wave gearing (harmonic drives), preferably with closed loop feedback drive. Think about kind of issues SCARA has and multiply it by square. Do you seriously intend to build (and mantain) a usable rotary delta printer, or are you thinking about just one-off proof of concept machine?

Mahmoudtamaa993 commented 6 months ago

Hi @Graylag-PD @ubertidavide @ariankhatb, Does Marlin firmware or smoothieware support Rotary Delta kinematics? if yes How can I configure the Marlin firmware for this specific Delta type? I appreciate any insights, guidance, or resources that can help me with the configuration and implementation of Marlin or smoothieware firmware for my rotary delta robot project. Thank you in advance!

thisiskeithb commented 6 months ago

Does Marlin firmware or smoothieware support Rotary Delta kinematics?

This is a feature request and support has not been added.

Graylag-PD commented 6 months ago

Hi @Mahmoudtamaa993 Although I would like to see rotary delta support in Marlin because I believe that in the long run this is the right way to go, building decent rotary delta consumer grade printer is almost impossible at this moment, hence almost nonexistent user base and little pressure to implement it. Do you plan to build just proof-of-concept machine, or more refined production machine? If just proof-of-concept, you might make it work just by altering equations used by inverse_kinematics() function in planner.cpp. You can either find the right equations on the internet, or I can send them to you. But if you want more refined machine, you will need to review a ton of other code because kinematics are tied to a lot of things.

3DSmitty commented 4 months ago

Any update on this? I am building Delta X1 with ESP32 and would love to be able to run marlin on it. I want it to be able to use the multi-functional tool head as well.

thisiskeithb commented 4 months ago

Any update on this?

No updates. This is still an open feature request.

3DSmitty commented 4 months ago

Any update on this?

No updates. This is still an open feature request.

Ok well when the rest of my hardware gets delivered I am going to jump on it.

3DSmitty commented 3 months ago

FYI looks like there were two rotary delta projects that used a custom version of Marlin v1.

https://github.com/firepick-delta/firepick-delta https://github.com/TTN-/IcePick-Delta

I am still waiting on hardware but I don't think it will be super hard to implement the kinematics.