Hilo build aka Gus 1.5ish

Re: Hilo build aka Gus 1.5ish

Postby Nicholas Seward » Sun Apr 12, 2015 7:53 pm

@rustynoob: First, nice work.



1) Side loading the bearings in pairs should remove all play. This is done professionally by putting an inner spacer that is undersized. A fully tightened joint will get rid of the play but will won't hurt the bearings once the spacer starts feeling compression. As I designed mine, it is possible to overtighten and cause too much friction (no inner spacer). I did this because 608 bearings are oversized for this and it would be a pain to get people to print perfect inner spacers. My approach is to tighten the joint until friction will keep it from freely rotating and then back it off a 1/4-1/2 turn or until the motion is buttery smooth. (This approach requires period joint tightening.)

2) I thought this could be from only having 1 gear stl but I looked back at the pictures and this isn't the reason. Do you have a picture of the problem? I can't quite figure out what you mean.

3) Where is it flexing? Can you add some plastic? However, don't fix it until it is a problem.
Nicholas Seward
 
Posts: 738
Joined: Mon Nov 25, 2013 10:41 pm

Re: Hilo build aka Gus 1.5ish

Postby rustynoob » Tue Apr 14, 2015 6:44 pm

Nicholas Seward wrote:My approach is to tighten the joint until friction will keep it from freely rotating and then back it off a 1/4-1/2 turn or until the motion is buttery smooth.

That is more or less what I ended up doing and it seems to be doing the trick.
Nicholas Seward wrote:2) I thought this could be from only having 1 gear stl but I looked back at the pictures and this isn't the reason. Do you have a picture of the problem? I can't quite figure out what you mean.

I think I got the rotation off just a bit somehow so that is sort of what the problem is... I think.
WP_20150412_14_09_35_Pro.jpg
offset problem
WP_20150412_14_09_35_Pro.jpg (310.45 KiB) Viewed 34219 times

Once it becomes a problem I should just need to fix and reprint one half of the gear.
Nicholas Seward wrote:3) Where is it flexing? Can you add some plastic?

The flexing seem to be both along the length of the arm and in the gear. I think If it ends up being a problem the first thing to do will be to make the gears thicker(smaller cutout not wider teeth). I suspect that changing the cross-section of the gear from a rectangle to a triangle may help it resist twisting as well.
If needed making the arms a little taller should make them more rigid.
But like you said
Nicholas Seward wrote: don't fix it until it is a problem.


Mostly this is a list of known weakness to look at fixing if they become problems or address in future updates to the design. The only one I expect to have to deal with to get good prints is the misalignment... and maybe the bearing to bolt clearance problem. I am concerned that even side-loading the bearings the slop between the bearing and the bolt will allow the joint and thus the calibration to shift randomly.
Joel
rustynoob.com
User avatar
rustynoob
 
Posts: 47
Joined: Mon Feb 16, 2015 3:30 am

Re: Hilo build aka Gus 1.5ish

Postby Nicholas Seward » Tue Apr 14, 2015 8:48 pm

I think the gear blank had 40 teeth. Did you rotate one by 4.5 degrees?
Nicholas Seward
 
Posts: 738
Joined: Mon Nov 25, 2013 10:41 pm

Re: Hilo build aka Gus 1.5ish

Postby rustynoob » Tue Apr 21, 2015 7:38 pm

I̶ ̶t̶h̶i̶n̶k̶ ̶I̶ ̶c̶o̶u̶n̶t̶e̶d̶ ̶t̶h̶e̶ ̶t̶e̶e̶t̶h̶ ̶a̶n̶d̶ ̶r̶e̶a̶s̶o̶n̶e̶d̶ ̶t̶h̶a̶t̶ ̶m̶i̶r̶r̶o̶r̶i̶n̶g̶ ̶i̶t̶ ̶s̶h̶o̶u̶l̶d̶ ̶w̶o̶r̶k̶.̶ I just went back and counted and it has thirty teeth. I musth have just tried flipping it and thought it looked right It has was to long ago and I did not document it at the time to remember for sure what I ended up doing.
I think once I get everything up and running I will try redoing it with a rotation instead of a mirror and a translate. That should fix things.
For now I'm focusing on getting it working as is. Repiter firmware won't compile... I suspect I am missing a dependancy somewhere but I almost have the calibration figured out using marlin. Now I just need to decide whether to put the kinematics into marlin or get repiter working.
Last edited by rustynoob on Wed Apr 22, 2015 9:43 pm, edited 1 time in total.
Joel
rustynoob.com
User avatar
rustynoob
 
Posts: 47
Joined: Mon Feb 16, 2015 3:30 am

Re: Hilo build aka Gus 1.5ish

Postby rustynoob » Wed Apr 22, 2015 9:11 pm

The Maths...
So I sat down this morning and started looking at the math for Gus to see what optimizations I could do to put it in the firmware and I ran across some interesting things... I think I may have made a mistake so correct me where I am wrong.

I believe this is the relivent portion of code as far as the math goes
Code: Select all
x1=-SIZE/2.0
y1=-SIZE*math.sqrt(3)/2.0/3.0
z1=-SHOULDER_Z1
x2=+SIZE/2.0
y2=-SIZE*math.sqrt(3)/2.0/3.0
z2=-SHOULDER_Z2
x3=0
y3=2*SIZE*math.sqrt(3)/2.0/3.0
z3=-SHOULDER_Z3
x0,y0,z0=getxyz(MAX_LENGTH_1,MAX_LENGTH_2,MAX_LENGTH_3)
coord={"X":x0+x1,"Y":y0+y1,"Z":z0+z1, "E":0, "F":0}


def getABC(position1):
    if "X" not in position1:
        return position1
    position=copy.deepcopy(position1)
    d=distance(coord,position)
    xs,ys,zs=coord["X"],coord["Y"],coord["Z"]
    x,y,z,f=position["X"],position["Y"],position["Z"],position["F"]
    a1=MAX_LENGTH_1-math.sqrt((xs-x1)**2+(ys-y1)**2+(zs-z1)**2)
    b1=MAX_LENGTH_2-math.sqrt((xs-x2)**2+(ys-y2)**2+(zs-z2)**2)
    c1=MAX_LENGTH_3-math.sqrt((xs-x3)**2+(ys-y3)**2+(zs-z3)**2)
    a2=MAX_LENGTH_1-math.sqrt((x-x1)**2+(y-y1)**2+(z-z1)**2)
    b2=MAX_LENGTH_2-math.sqrt((x-x2)**2+(y-y2)**2+(z-z2)**2)
    c2=MAX_LENGTH_3-math.sqrt((x-x3)**2+(y-y3)**2+(z-z3)**2)
    virtual_d=math.sqrt((a1-a2)**2+(b1-b2)**2+(c1-c2)**2)
    fnew=f
    if d!=0:
        fnew=f*virtual_d/d
    position['X']=a2
    position['Y']=b2
    position['Z']=c2
    position['F']=fnew
    return position

def distance(start, end):
    try:
        x1,y1,z1=start['X'],start['Y'],start['Z']
        x2,y2,z2=end['X'],end['Y'],end['Z']
        return math.sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
    except:
        return 0

First off I noted that every time the main body of getABC gets called the first relivant thing that happens is distance() is called.
Code: Select all
def getABC(position1):
...
    d=distance(coord,position)
 

Inside distance x1, y1, z1, x2, y2, z2 are all set
Code: Select all
def distance(start, end):
    try:
        x1,y1,z1=start['X'],start['Y'],start['Z']
        x2,y2,z2=end['X'],end['Y'],end['Z']
        return math.sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
    except:
        return 0

also because the sqrt always takes a sum of squares the value will always be positive so the try will always succed.
so if we substitute the part of the function body that gets exicuted into getABC() we get
Code: Select all
    start[] = coord
    end[] = position
    x1,y1,z1=start['X'],start['Y'],start['Z']
    x2,y2,z2=end['X'],end['Y'],end['Z']
    d=math.sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
    xs,ys,zs=coord["X"],coord["Y"],coord["Z"]
    x,y,z,f=position["X"],position["Y"],position["Z"],position["F"]
   

or in essence
Code: Select all
x1,y1,z1=coord['X'],coord['Y'],coord['Z']
x2,y2,z2=position['X'],position['Y'],position['Z']
xs,ys,zs = x1,y1,z1
x,y,z,f = x2,y2,z2,position["F"]

if we make these substitutions back into the messy sqrt bits then
Code: Select all
    a1=MAX_LENGTH_1-math.sqrt((x1-x1)**2+(y1-y1)**2+(z1-z1)**2)
    b1=MAX_LENGTH_2-math.sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
    c1=MAX_LENGTH_3-math.sqrt((x1-x3)**2+(y1-y3)**2+(z1-z3)**2)
    a2=MAX_LENGTH_1-math.sqrt((x2-x1)**2+(y2-y1)**2+(z2-z1)**2)
    b2=MAX_LENGTH_2-math.sqrt((x2-x2)**2+(y2-y2)**2+(z3-z2)**2)
    c2=MAX_LENGTH_3-math.sqrt((x2-x3)**2+(y2-y3)**2+(z2-z3)**2)

This can be further reduced to
Code: Select all
 
    a1=MAX_LENGTH_1-math.sqrt((0)**2+(0)**2+(0)**2)
    b1=MAX_LENGTH_2-d
    c1=MAX_LENGTH_3-math.sqrt((x1-x3)**2+(y1-y3)**2+(z1-z3)**2)
    a2=MAX_LENGTH_1-d
    b2=MAX_LENGTH_2-math.sqrt((0)**2+(0)**2+(0)**2)
    c2=MAX_LENGTH_3-math.sqrt((x2-x3)**2+(y2-y3)**2+(z2-z3)**2)

which because the square root of 0 returns 0 reduces to
Code: Select all
 
    a1=MAX_LENGTH_1
    b1=MAX_LENGTH_2-d
    c1=MAX_LENGTH_3-math.sqrt((x1-x3)**2+(y1-y3)**2+(z1-z3)**2)
    a2=MAX_LENGTH_1-d
    b2=MAX_LENGTH_2
    c2=MAX_LENGTH_3-math.sqrt((x2-x3)**2+(y2-y3)**2+(z2-z3)**2)

substuting in the equations
Code: Select all
  virtual_d=math.sqrt((a1-a2)**2+(b1-b2)**2+(c1-c2)**2)
 

becomes
Code: Select all
 
 virtual_d=math.sqrt((MAX_LENGTH_1-(MAX_LENGTH_1-d))**2 +(MAX_LENGTH_2-d-MAX_LENGTH_2)**2 +(c1-c2)**2)

which with some simple algebra becomes
Code: Select all
 virtual_d=math.sqrt((d)**2+(d)**2+(c1-c2)**2)

so asuming my algebra is all correct we end up with
Code: Select all
def getABC(position1):
    if "X" not in position1:
        return position1
    position=copy.deepcopy(position1)
    d=distance(coord,position)
    c1=MAX_LENGTH_3-math.sqrt((x1-x3)**2+(y1-y3)**2+(z1-z3)**2)
    c2=MAX_LENGTH_3-math.sqrt((x2-x3)**2+(y2-y3)**2+(z2-z3)**2)
    f=position["F"]
    virtual_d=math.sqrt(2*(d**2)+(c1-c2)**2)
    fnew = d==0?f:f*virtual_d/d   
    position['X']=MAX_LENGTH_1-d
    position['Y']=MAX_LENGTH_2
    position['Z']=c2
    position['F']=fnew
   
    return position

That means that position["Y"] that is returned is a constant which doesn't make since to me so maybe I misunderstand what the function is used for or more likely I made a dumb algebra error somewhere... I'm really good at that
Joel
rustynoob.com
User avatar
rustynoob
 
Posts: 47
Joined: Mon Feb 16, 2015 3:30 am

Re: Hilo build aka Gus 1.5ish

Postby Nicholas Seward » Wed Apr 22, 2015 10:06 pm

The distance function is to find the carestian distance from the last point to this point. This is used solely for scaling the feed rate in the gus coordinate system. The x1,y1,z1,x2,y2,z2 values don't escape that function. If you look at the top of the code you will see the global values used for those.

Code: Select all
x1=-SIZE/2.0
y1=-SIZE*math.sqrt(3)/2.0/3.0
z1=-SHOULDER_Z1
x2=+SIZE/2.0
y2=-SIZE*math.sqrt(3)/2.0/3.0
z2=-SHOULDER_Z2
x3=0
y3=2*SIZE*math.sqrt(3)/2.0/3.0
z3=-SHOULDER_Z3



Annotated code:
Code: Select all
d=distance(coord,position) #get cartesian distance from last position
    xs,ys,zs=coord["X"],coord["Y"],coord["Z"] #get last position coords
    x,y,z,f=position["X"],position["Y"],position["Z"],position["F"] #get this position coords
    a1=MAX_LENGTH_1-math.sqrt((xs-x1)**2+(ys-y1)**2+(zs-z1)**2) #get last machine coords
    b1=MAX_LENGTH_2-math.sqrt((xs-x2)**2+(ys-y2)**2+(zs-z2)**2)
    c1=MAX_LENGTH_3-math.sqrt((xs-x3)**2+(ys-y3)**2+(zs-z3)**2)
    a2=MAX_LENGTH_1-math.sqrt((x-x1)**2+(y-y1)**2+(z-z1)**2) #get this machine coords
    b2=MAX_LENGTH_2-math.sqrt((x-x2)**2+(y-y2)**2+(z-z2)**2)
    c2=MAX_LENGTH_3-math.sqrt((x-x3)**2+(y-y3)**2+(z-z3)**2)
    virtual_d=math.sqrt((a1-a2)**2+(b1-b2)**2+(c1-c2)**2) #get gus/machine coordinate system distance from last position
    fnew=f #get cartesian feed rate
    if d!=0:
        fnew=f*virtual_d/d #scale the cartesian feed rate to get the machine feed rate


The only thing that is really important is. "Good" firmware should only need this an maybe the forward kinematics.
Code: Select all
a=MAX_LENGTH_1-math.sqrt((x-x1)**2+(y-y1)**2+(z-z1)**2)
b=MAX_LENGTH_2-math.sqrt((x-x2)**2+(y-y2)**2+(z-z2)**2)
c=MAX_LENGTH_3-math.sqrt((x-x3)**2+(y-y3)**2+(z-z3)**2)

x1,y1,z1 is the location of the first shoulder pivot.
x2,y2,z2 ...
x,y,z is the location of the effector.
a,b,c are the positions of the steppers.

Here is a start for the forward kinematics...
Code: Select all
def getxyz(r1,r2,r3):
    d=SIZE*1.0
    i=SIZE/2.0
    j=SIZE*math.sqrt(3)/2.0
    x=(r1*r1-r2*r2+d*d)/(2*d)
    y=(r1*r1-r3*r3-x*x+(x-i)**2+j*j)/(2*j)
    z=math.sqrt(r1*r1-x*x-y*y)
    return x,y,z

I say start because the x and y coordinates or possibly translated and rotated. However, the z coordinate is right and that is what I need that function for. (z leveling) The function uses trilateration. Trilateration is the process of taking 3 distances (laterals/stepper positions) from know locations (shoulder positions) to find a position (effector position). This math is hard unless you put one shoulder at 0,0 and another on the x axis. The typical approach is to translate the shoulder to align with this simplifications and then after you get a position translate it back. I didn't do that last step because it wouldn't change the z position and that is all I needed.

What I am saying is that Smoothieware should only require a inverse kinematic function and possibly a forward kinematic function (typically needed for end stop checking). Marlin on the other hand may require much more work. However, The Simpson math is very similar to delta math so it may not be that hard to port.
Nicholas Seward
 
Posts: 738
Joined: Mon Nov 25, 2013 10:41 pm

Re: Hilo build aka Gus 1.5ish

Postby rustynoob » Wed Apr 22, 2015 10:17 pm

okay Thanks. I guess It has been to long since I wrote any python and I forgot how its scoping works. :oops: I knew I had to be doing somethingwrong.
so a, b, and c are the arm lenghts for the given x,y,z coordinate.
Joel
rustynoob.com
User avatar
rustynoob
 
Posts: 47
Joined: Mon Feb 16, 2015 3:30 am

Re: Hilo build aka Gus 1.5ish

Postby Nicholas Seward » Wed Apr 22, 2015 10:22 pm

Yep, a,b,c are stepper positions which is directly related to arm length. ARM_LENGTH_1=MAX_LENGTH_1-a
Nicholas Seward
 
Posts: 738
Joined: Mon Nov 25, 2013 10:41 pm

Re: Hilo build aka Gus 1.5ish

Postby rustynoob » Thu Apr 23, 2015 2:42 am

after a day of playing with the marlin codebase it seems to mostly work now... except it still needs to be properlly calibrated and is confused about up and down. + movement on the z axis goes towards the bed and negative movement goes away from the bed.
I guess it is time to look deeper into the code base
Joel
rustynoob.com
User avatar
rustynoob
 
Posts: 47
Joined: Mon Feb 16, 2015 3:30 am

Re: Hilo build aka Gus 1.5ish

Postby rustynoob » Fri Apr 24, 2015 9:50 pm

So I inverted everything and that is why I had the problem. To fix it I took out the "MAX_LENGTH_A -"
That way fully extended is fully extended and fully retracted is fully retracted. I use max endstops and just have to set the homing position properlly. It seems to be working... other than me not having long enough calipers to properly calibrate MAX_LENGTH. It should be right around 330mm but I was having problems with the end stops I was using not giving me good repeatability. I am changing to opto end stops because they will be almost a direct repoacement. I just have to bolt a tab where I have a magnet and put the opto endstop board where I have the the Halleffect board... and calibrate the filiment drive.
On the topic of the filament drive when I use the manual movement functions to move the filament drive it makes the arm motors vibrate instead of moving the filament. I am guessing I must have messed something up in marlin_main while I was adding gus to it. Anyone have any Ideas what? I think I'll go sign up on the reprap forums and ask over there as well.
Joel
rustynoob.com
User avatar
rustynoob
 
Posts: 47
Joined: Mon Feb 16, 2015 3:30 am

PreviousNext

Return to GUS Simpson

Who is online

Users browsing this forum: No registered users and 1 guest

cron