Robotic kinematics



  • @dc42 I want to build a 5 axis robot and would have started with developing firmware and documentation. But I know you're working on it also. So it may make more sense that I build the robot only. Do you have a time plan for implementing the kinematics? If you need development help for the robotics, I offer helping force.

    I will build a robot based on belt based gears, the last hinge near the hotend probably harmonic drive. My main focus will be on stability and good hinges to achieve good enough precision.


  • administrators

    This was on my list to do, but has been postponed because of more pressing firmware development. If you want to help with it, see https://github.com/Duet3D/RepRapFirmware/blob/dev/AddingNewKinematics.md for how to get started.



  • @dc42 I just didn't want to get in your way. I will start with firmware and documentation and will tell about progress here in this thread.


  • administrators

    Thanks, you won't get in my way because I don't have it scheduled to implement.



  • I've started with documentation now:
    https://duet3d.dozuki.com/Wiki/Configuring_RepRapFirmware_for_a_FiveAxisRobot
    If someone has wishes what I should implement in addition to my current thoughts, please tell me.
    I will develop the firmware next.



  • @dc42 I've developed and tested an initial version now, could you please check that the proposed parameters are ok? Would be nice if you can assign a K number for the kinematics.

    I want to build the prototype next to validate the code in reality.

    Documentation of the parameters: https://duet3d.dozuki.com/Wiki/Configuring_RepRapFirmware_for_a_FiveAxisRobot?revisionid=HEAD
    cpp source: https://github.com/JoergS5/RepRapFirmware/blob/v3.02-dev/src/Movement/Kinematics/FiveAxisRobotKinematics.cpp
    h source: https://github.com/JoergS5/RepRapFirmware/blob/v3.02-dev/src/Movement/Kinematics/FiveAxisRobotKinematics.h


  • administrators

    That was quick! I've allocated you kinematics type 13 for 5-axis robot arm. I'll review your parameters soon.



  • @JoergS5

    hi i am the one who helped set up eclipse with windows 7 to recompile rrf 3 firmware on duet 6ch. I would like to try five axis robot, I saw that the test version is on rrf v 3.02-dev but eclipse gives me errors it does not compile, the version I have is the rrf 3.1.0 which eclipse compiles perfectly. I could take FiveAxisRobotKinematics.cpp and FiveAxisRobotKinematics.h import them into my rrf 3.1.0 and using procedures 1 to 4 of dc42 Update AddingNewKinematics.md compile the firmware with eclipse? or will I find problems? five axis robot.JPG compilazione firmware.JPG
    there are 2 things with I don't understand M669 K13 X20.0: 5.0 Y0.0: 10.0 Z50.0 R1 L300.0: 400.0: 200.0: 100.0 P0 I don't know how to set x20.0: 5.0 y0.0: 10.0 m669 k13.JPG
    and the other and I can put the robot in the Cartesian plane where I want or maybe the center of the 1st axis is on x0 y0? xy.JPG
    I think I understand the other parameters but I can't understand the function of x and y in m669 if you can help me thanks!



  • @tony73 Hi, I took tag 3.1.0 versions and this compiles good with the two files. v3.02 sometimes has compilation errors, so I took the tag.

    The X, Y, Z parameters are the absolute coordinates of axis 1 and 2, if the arms 2 and 3 are horizontal, like in the second image.

    Second Y is the distance between axis 1 and 2, so if it is 0, arm 2 goes through axis 1. This is how most robots are built, but I wanted flexibility, if I cannot construct it precise.

    So the first X and Y coordinates are for the big horizontal plate with vertical axis, the second parameters and only Z for axis 2, which rotates arm 2 up and down.

    So the example means axis 1 is X coordinate 20 and Y 0, axis 2 is left of it, 10 behind in y direction, and at absolute high 50. Where axis 1's height is, is not important to calculate the kinematics. All those with arms2-3 horizontal (parallel to x axis, looked from above, bird's view)

    I tried to make it clear in the two images in the intro.

    You don't need all steps, it is in the source partly already, David added the kinematics to it (K13). You only need step 4.

    Do you currently build a prototype? I ask because I tested forward and inverse kinematics for my arm lengths (about 50 million tests forward and back), and you can provide me your parameters to validate the methods, if you wish. I can tell you the printable region also, then.



  • @JoergS5

    I have been working on a single arm scara for a long time and I am constantly discovering new features, it is amazing what it can do! I have been wondering for some time if duet 3 could handle a robot arm and if the kinematics would be done one day, then I saw your five axis robot !!! and I said there we are !!! I am planning to build a prototype robot arm and I was trying to understand the configuration !! why did you make a 5 axis arm and not 6? i maybe and can add the 6 axis? do you already have a prototype to see? I ask you one last thing about this parameter (see photo)plotter.JPG
    not implemented in the future could it work, would it be able to keep a plotter blade in the direction of the cut like the outline of a character drawing for example?
    I hope I explained myself! thank you!



  • @tony73 yes, P3 is thought for such a use case, I thought of a concrete printing robot where the direction is important or printing while inserting a wire in front of or after it to enforce. The reason why I wrote not supported yet is that the print path must be known before the movement, and this is not included in the firmware yet. But DDA/Movement could set the path at the beginning of a move. But I wanted to begin easy.

    That's also the reason why not 6 axis: starting with an easier kinematic first.

    I have also some ideas, eg using it for cnc, painting, and tons of other ideas. But I want to make sure it is precise enough first.

    Please let us stay in contact building our prototypes.

    I will start with a parallelogram based like in https://journals.sagepub.com/doi/pdf/10.1177/1687814018761297 because it has high precision (I hope). That's the reason for parameter R1. The R1 mode only needs 4 actuators plus one for the extruder, so even a Duet2 without any extension can be used.



  • This post is deleted!


  • @JoergS5

    I ask you for a final clarification the home5axisrobot.g homing of the arm and a single position with the arm fully extended horizontally to the left along the x axis and it is also possible to assume a position for example closed on itself or another different position, such as this as soon as the video begins ? https://www.youtube.com/watch?v=pnbJZ8LUGwg



  • @tony73 Wow, that's a nice robot!!

    I don't understand your question, but maybe because it's too late today. You want to measure multiple positions or is the question whether you can measure at a specific position?

    In general arm 2 and arm 3 (and other arms also) can always have two positions, top or down. For kinematics and inverse kinematics to be the same result, I take the upper position. So some or your robot's movement are probably not supported. I did not test axis 2's degrees bigger than 90 degrees yet, because for the hotend to be outside of axis 1's plate, arm 2 will often be a low angle. But I will extend the testing to the other possible angles, after I saw that you are using it.



  • @JoergS5

    ok! I'm sorry but I'm the one sending you into confusion, I explain myself badly. (simulation) if I turn on the 5 axis robot based on the M669 K13 X20.0: 5.0 Y0.0: 10.0 Z50.0 R1 L300.0: 400.0: 200.0: 100.0 P0 and A-45: 45: 0: 75: -75: -5: -170: 170: -135: 135 which is the configuration of your example I type M114 which positions of X, Y, Z.... would I see respond from duet? I would like to understand where the robot arm thinks it is before homing the 5 axes! I will start building the robot as soon as possible, surely as I did with scara in rrf I will encounter problems with the configuration I will ask you for help if you will be patient! thanks, see you soon!



  • @tony73 the problem with homing is, the starting position of the steppers is not known! The stepper rotates until the endstop is hit. So the robot must home in such a strategy that the different axes are homed with valid movements.

    An alternative is to make sure the starting positions are near the endstops already, so for homing only a few small movements are necessary.

    I thought about this also and had the idea that an external measuring system could give duet a hint about the current status, eg a camera image analysis.

    Or always stop the robot at a known position at turn off and store that this procedure went well, so at startup duet can see whether it can start or should wait for user controlled moves into start position.

    One more approach is to use absolute encoders, where the robot and duet always know where the axes are.



  • @tony73 good morning, now I am awake to answer your questions better!

    M114 is a command to know the coordinates if the firmware already knows where the axes are. But as I explained in the previous comment, when you turn on the Duet, he doesn't know where it is. That's the reason for homing: rotate the steppers until it hits the axis movement with an endstop. You know where you installed the endstop, so you tell the firmware in the configuration where the endstop is, and the firmware can set the coordinates from this information. It is also possible to set the coordinates explicitly with G92.

    Do you plan to use your robot for 3D printing, or build a new robot? If you want to use the exisiting one, you'll need to add the extruder/hotend part with arm 5. I am still thinking about how to construct axis 5 and arm 5 best. My plan is to split arm 5 into two parts to allow to make a tool changer.



  • @JoergS5

    Hello! you want to do a great job !! i thought it was a situation like scara when duet is turned on before homing thinks to be parallel to x axis with motor x 0 degrees approximately y 0 degrees with M114 responds with x398 and y0 because my scara with proximal arm 200 mm distal 200 mm . i tried to compile the firmware i had rrf 3.1.0 downloaded days ago when i got your help adding FiveAxisRobotKinematics.cpp and FiveAxisRobotKinematics.h taken from https://github.com/JoergS5/RepRapFirmware/tree/v3.02-dev/src/Movement/Kinematics
    made step 4 fromhttps://github.com/Duet3D/RepRapFirmware/blob/dev/AddingNewKinematics.md

    but there are errors does not compile!
    errore five axis.JPG

    can you tell me where am I wrong? should i download a new rrf 3.1.0?



  • @tony73 this is step 4, adding the fiveAxisRobot to the Kinematics file, three places:

    in Kinematics.cpp:
    #include "FiveAxisRobotKinematics.h"

    then in the switch statement:
    case KinematicsType::robot5axis:
    return new FiveAxisRobotKinematics();

    and in Kinematics.h in the enum of KinematicsType:
    robot5axis,

    David had renamed it from fiveAxisRobot to robot5axis, so I changed it also.

    In the .h it must be at the correct position:
    ...
    markForged,
    collinearTriperon, // reserved...
    robot5axis,
    unknown // this one must be last!
    };



  • @JoergS5

    ok! thanks I tried, successful compilation !!



  • @tony73 when you're ready with setup, please tell me your M669, then I can calculate whether all positions are calculated correctly (kinematics and inverse kinematics) - if you want.

    PS to calculate errors exactly, I need steps/degree values of the actuators also (the M92 settings).



  • @JoergS5
    good morning ! i was trying duet 3 6ch with 5 stepper motors connected (one test) to see, in config .g gave M669 of your example M669 K13 X20.0: 5.0 Y0.0: 10.0 Z50.0 R0 L300.0: 400.0: 200.0 : 100.0 P0 but I changed R1 to R0 to have 5 stepper motors, duet 3 is connected to the pc with usb and simplify 3d. If I write M699 it responds like this
    simplify m669.JPG

    the lengths of the arms are missing and the parameter (R) if I write M669 L300.0: 400.0: 200.0: 100.0 accepts the arms but for (R0) nothing does not accept! what problem could that be?
    M669 L parametro.JPG

    another thing is the total homing, it should be (home5axisrobot.g) but writing G28 does not accept only (homeall.g) or single axes, example (homex.g) , help !!!!home5axisrobot.JPG

    here is the (config.g) not very accurate fact, for a kidnapped test and little time available! Hello !!
    config 1.JPG

    config 2.JPG



  • @tony73 I cannot detect a bug in the source at the first view. Please let me some time, I can look at it the next days.

    The homeall file is called home5axisrobot.g and homallg is not needed. This was a declaration in
    static constexpr const char *Home5AxisRobotFileName = "home5axisrobot.g";
    but I am not sure whether it is used correctly. I will check it also.



  • I've used the term kinematics a number of times in this lecture and I haven't really been very clear about what it means. Kinematics is a branch of mathematics ...



  • @Antomy5 I don't know the definition, but I know what it means at 3D printers and robots: kinematics are functions of movement from actuators to the cartesian coordinates, and inverse kinematics is the other direction.
    Kinematics in physics describe the motion of points or bodies, I think this is similar.


Log in to reply