#robotics | Logs for 2016-11-12

Back
[01:22:07] <branjb> i accidently wrote code that works and i don't understand how it works at all
[02:00:08] <rue_bed> what language?
[02:03:46] <SpeedEvil> he doesn't know.
[02:03:52] <SpeedEvil> he just banged the keys
[02:12:34] <rue_bed> aha
[02:13:13] <rue_bed> for the cnc machine If I bolt the lead screw between two centers, and use something like a gear to drive it, I wont have backlash
[02:13:37] <rue_bed> and if i use a synchobelt, I wont have any gear lash
[02:13:47] <rue_bed> k
[02:23:06] <rue_bed> damnit why am I so tired
[02:23:18] <rue_bed> oh yea, I are one pack of noodles today
[02:23:24] <rue_bed> and spagetti for supper
[02:23:26] <rue_bed> hmm
[04:42:10] <rue_shop3> !@#$$!@@#$??? Tom_L does the sherline use a plastic jib???
[04:43:07] <rue_shop3> gib
[04:43:25] <rue_shop3> it is!!! !?!?!?!?1
[04:47:35] <rue_shop3> Tom_L, have you ever had to replace it!?
[05:05:56] <rue_shop3> oooh look, 60 degrees isn't 60, its 30
[05:06:07] <rue_shop3> which means I can cut dovetails on the table saw
[05:37:21] <rue_house> hmm, about $700 to upgrade my lathe to a brushless motor with speed control
[05:59:02] <rue_shop3> wow, head on the lathe is 0.6mm low
[06:06:02] <rue_shop3> the 3 jaw is .16mm off
[07:49:54] <rue_shop3> I suppose if you have a threaded rod and a much larger nut, but with the same thread pitch, and the right size balls, you can make a ball screw
[07:51:14] <veverak> question is how well it will work
[07:51:27] <rue_shop3> or, to reduce the mass, I spin the nut instead
[07:51:31] <veverak> afaik the shape of the thread is pretty crucical for correct functionality ;)
[07:51:37] <rue_shop3> veverak, it would wear in a lot
[07:51:38] <veverak> but that needs testing
[07:51:57] <rue_shop3> maybe I'll do with spinning the nut
[07:52:03] <veverak> also
[07:52:14] <veverak> it can be tricky to find correct match for sizes of rod/nut/balls ;)
[07:52:29] <rue_shop3> china has lots of balls
[07:52:37] <veverak> not exactly space for backlash and I can't really see sensible way of adjusting any of it
[07:52:38] <rue_shop3> all different size ones
[07:53:00] <rue_shop3> you could split the nut, and clamp it tighter on the balls
[07:53:29] <rue_shop3> uneven wear would be an issue
[07:53:29] <veverak> hmm, yeah
[07:53:30] <rue_shop3> tho
[07:53:45] <rue_shop3> my cnc has used normal threaded rod for years and not worn it
[07:54:03] <rue_shop3> not that I use it a lot
[08:00:06] <Tom_L> rue_shop3, how you gonna do the return path on the balls?
[08:03:47] <rue_house> two holes and a ... well I could just 3d print a return pipe
[08:04:55] <rue_house> I dont have balls small enough and I dont think I want to wait for them, so ... we will see
[08:05:13] <veverak> 3d print balls!
[08:05:15] * veverak hides
[08:05:26] <rue_house> pff
[08:06:47] <Tom_L> i can get them locally
[08:07:02] <Tom_L> i've done it several times for different apps
[08:07:05] <rue_house> according to the math, with 11tpi, I'd want worst 1:1 with the motor
[08:07:25] <rue_house> so using 5/8"-11 is evil cause of the mass of the threaded rod
[08:08:56] <rue_house> I almost got the first axis sliding on that cnc I was building a while ago
[08:10:05] <rue_house> http://ruemohr.org/~ircjunk/projects/cnc3/p1070987.jpg
[08:10:16] <rue_house> that was long ago
[08:10:41] <rue_house> I didn't know the gibs on the sherline were plastic
[08:10:50] <rue_house> that makes it more amazing to me
[08:14:23] <rue_bed> I dont think rigidity is the limiting factor in making a machine
[08:14:41] <rue_bed> I think its the speed of the spindle and the force the bit can take
[08:21:15] <SpeedEvil> Rigidity sets consistency of cut
[08:22:32] <SpeedEvil> If you have a toolbit which has a nice consistent cut (say a full depth engaged spiral cut bit), and are not cutting anything with significant force, then all irrigidity does is to offset your cut a little
[08:23:27] <SpeedEvil> If you don't, then you have problems as your tool now starts to vibrate and take inconsistent and uncontrollably different cuts, possibly breaking it.
[08:24:05] <SpeedEvil> High speed spindles and low tool forces can mitigate a lot of problems.
[11:29:51] <branjb> I have a PI/4 offset that makes my algorithm work and have no idea where it comes from
[11:30:18] <branjb> angle between robot and goal is Beta = (atan2(target_y - y, target_x - x)) - (PI/4);
[11:31:01] <branjb> and my error is error = (Beta - theta) * RAD_TO_DEG;
[11:31:01] <branjb> where theta is robots current orientation
[11:31:36] <branjb> if I try to go to 0,100 then beta is 90 degrees as expected, but robot tracks to 135 degrees, hence using the PI/4 offset
[11:32:13] <branjb> in my PID error never goes to zero, but instead error converges to 45 degrees
[11:33:23] <z64555> why is error in degrees
[11:33:49] <branjb> just to make my gains smaller
[11:34:19] <branjb> in radians I had to make the gains really big, just a preference thing
[11:35:23] <z64555> eh, that just obfuscates things, really
[11:37:14] <branjb> never seen an error converge to anything but zero though, it's weird
[11:37:52] <branjb> tempted to just leave it because it works but i don't like not knowing why
[11:37:56] <z64555> better to keep your units the same everywhere "internal" to the machine, and only switch units if you want to send them to a readout or absolutely must work with a module that has different units
[11:38:42] <z64555> the PI/4 facto makes little sense
[11:38:51] <branjb> yep
[11:38:56] <branjb> if I give it 200,200 as a goal
[11:39:03] <branjb> theta converges to 90
[11:39:13] <branjb> if i give it 200,0 theta converges to 45
[11:39:13] <branjb> etc
[11:39:35] <branjb> ^without the PI/4 offset
[11:44:17] <z64555> set a breakpoint right after the calculation of Beta and see what it is
[11:44:46] <z64555> oh, you said beta was as expected, 90 degrees, etc.
[11:44:48] <z64555> ok
[11:45:06] <branjb> I have, it's always 45 once it's converged
[11:45:26] <z64555> Beta, or from the PID?
[11:45:38] <branjb> oh
[11:46:23] <z64555> if the PID is consistenantly PI/4 rads away from beta, then your PID is messed up
[11:46:39] <z64555> but if Beta is consistantlye PI/4 away from the expected result, atan2 is messed up
[11:46:50] <branjb> for now I'm only calculating the initial beta and then changing my theta based on that; it's not correct in terms of always going on a bearing towards goal, but i wanted to initially get the algorithm correct in converging to a non-changing angle before it's chasing a changing angle
[11:48:08] <z64555> you'll get a hook-like path if you do that
[11:48:16] <z64555> instead of a smooth arc
[11:49:07] <z64555> which would make sense, now that I think of it, for large angles
[11:49:25] <z64555> Don't want your bot making a spiral path to the target spot
[11:50:17] <z64555> hm? no? even with a PID you can get a fairly smooth curve without spiraling
[11:52:42] <z64555> ok, whats your PID algorithm look like? please use something like pastebin if you want to post code
[11:54:10] <branjb> yeah once I get the converging to angle figured out I'll update beta every 1 sec or so
[12:00:00] <branjb> http://pastebin.com/b6fAzFup
[12:02:14] <z64555> err
[12:02:23] <z64555> errSum is error - last_error?
[12:02:53] <branjb> oops
[12:03:03] <branjb> it's supposed to be += and not set to 0 each loop
[12:05:16] <z64555> why is there a base speed for each wheel?
[12:06:11] <branjb> it's the desired velocity when error = 0
[12:07:29] <z64555> so they're the same value?
[12:07:58] <branjb> yeah
[12:12:31] <branjb> ok, so I fixed the I term, and now it's converging to 38 instead of 45
[12:12:53] <branjb> so the PI/2 being a nice neat number may have been coincidence
[12:15:04] <z64555> ok, so tinker with your I term a bit more
[12:15:27] <branjb> can gains make errors converge to non-zero numbers?
[12:15:30] <z64555> nullify the dt term while you're doing so
[12:15:51] <z64555> definitely
[12:16:31] <branjb> i've only seen PID loops converge to error = 0, or diverge, but never another number
[12:17:03] <z64555> that's from the Integrator
[12:17:30] <z64555> it currently doesn't have a strong enough influence, so it converges to a non-zero output
[12:18:08] <branjb> with kp = 1, kd = 0, ki = 0, it converges to 15 now
[12:18:10] <branjb> interesting
[12:18:42] <z64555> ok, so possibly the opposite problem, integrator influence is too strong
[12:19:08] <z64555> just keep tinkering with kp and ki until you get it to converge to 0
[12:19:28] <branjb> yup
[12:19:45] <branjb> kp wasn't high enough
[12:19:50] <branjb> slowly getting it down to 0 now
[12:20:02] <z64555> once you get that in, start modifying the kd to adjust the (something?) rate
[12:20:22] * z64555 tries to remember the term
[12:21:05] <z64555> response rate, perhaps?
[12:21:43] <branjb> I always think of it in terms of quadcopters since that's where I first learned about it
[12:22:19] <branjb> d helps dampen oscillations as you're about to hit your goal
[12:23:22] <z64555> or make them larger. :D
[12:23:30] <branjb> haha
[12:23:31] <branjb> yeah
[12:25:00] <branjb> after you have p set, do you like to tune d or i next? i've heard people do both
[12:28:44] <z64555> it think it's i, but you can do both to see what happens
[12:46:49] <branjb> rock solid now
[12:55:16] <branjb> so the way that I am driving the orientation, I'm not updating the beta angle every iteration of the PID loop based on a goal x,y and the robot current x,y. It controls the difference in the motor speed to steer it, and after a few seconds left motor = right motor and heading stays constant. to stop at goal, is it as simple as just another PID loop controlling motor speed with the error
[12:55:16] <branjb> being distance to goal?
[12:55:26] <branjb> err
[12:55:31] <branjb> I'm now updating beta with every iteration
[12:56:29] <branjb> so in my case, a second loop with error being distance to goal, and it controlling base motor speed
[12:59:35] <branjb> heh
[12:59:44] <branjb> just realized i'm doing my logic in polar coordinates
[12:59:57] <branjb> radius, angles
[13:11:23] <z64555> yup
[13:11:29] <branjb> haha
[13:11:40] <branjb> it works, except when it gets to goal, it goes crazy
[13:12:01] <z64555> spins around, yeah?
[13:12:04] <branjb> probably just need to terminate the loop when it gets to +/- a small amount
[13:12:05] <branjb> yeah
[13:13:03] <z64555> yeah, just shut off the steering loop when it's close enough to the target position on the floor
[13:13:23] <z64555> you want to leave that loop on during transit
[13:13:44] <branjb> I need slower motors too, these ones have a minimum rpm of about 100 unfortunately
[13:14:01] <z64555> just gear em
[13:14:40] <z64555> wait, min rpm?
[13:14:43] <branjb> yeah
[13:14:53] <branjb> 100-250 RPM on the output shaft
[13:15:00] <branjb> they have built in gears
[13:15:10] <z64555> does it have a speed controller in it, too?
[13:15:19] <branjb> nope, just brushed DC
[13:15:33] <branjb> just driving them via a H bridge and pwm's
[13:15:39] <z64555> how many wires are coming out of it
[13:16:08] <branjb> at ~3V it does ~100rpm, at <3V it just stalls
[13:16:16] <branjb> voltage, ground
[13:16:48] <z64555> do you have a link to the motor's spec sheet?
[13:16:57] <branjb> yeah, hang on
[13:17:10] <branjb> http://www.robotshop.com/media/files/pdf/datasheet-2274.pdf
[13:17:19] <z64555> ty
[13:17:57] <branjb> let me know if there's a better solution, i'm pretty naive in anything but stepper motors
[13:18:28] <z64555> oh
[13:18:39] <z64555> ok
[13:18:44] <z64555> Yeah. I know what's going on
[13:19:23] <z64555> You can move at a slower rate, but when initially driving you need more voltage to break inertia and static friction
[13:19:59] <branjb> ahh
[13:20:15] <z64555> the gearing has both in it, too
[13:20:17] <branjb> and probably to drive the gears, it's pretty hard to even turn it by hand
[13:20:49] <z64555> it's a 47:1 gearing, so yeah
[13:21:05] <z64555> possibly a planetary or a worm gear
[13:21:58] <branjb> oh man
[13:22:13] <branjb> even without slowing down, terminating the loops when DistanceToGoal < 10 works amazing
[13:22:14] <branjb> spot on
[13:22:32] <branjb> it's pretty light so no slipping
[13:31:49] <branjb> robotics is so fun
[13:32:28] <z64555> especially when it works the way you intended to do, or otherwise spectacularly wrong
[13:33:03] <branjb> this is the first time with this robot that it's been working as intended, pretty nice feeling
[13:33:29] <z64555> image a 15lb wheelchair going full blast at the target location, and not stopping, and smoothly going out the door into the class across the hall
[13:34:24] <justanotheruser> alright, what do you think of this motor for a robot arm http://www.ebay.com/itm/NEMA34-Hybrid-Stepper-Servo-Closed-Loop-Motor-Drive-12NM-86J18156EC-1000-2HSS86H-/121787201520?hash=item1c5b1537f0:g:y2AAAOSwPCVYBJ-a
[13:34:30] <branjb> https://goo.gl/photos/rC6aGFw7Ezq1NPw97 this worked out pretty well, but it was mostly just #including a line follower library. everything I've been doing lately has been my own idea
[13:34:33] <justanotheruser> I like this one, I can use a wall outlet
[13:34:46] <branjb> did that happen z64555?
[13:35:18] <z64555> nah, not to me personally, but it almost did happen to another team
[13:35:28] <branjb> that's awesome
[13:35:32] <z64555> They were able to stop it before it got into the hall
[13:35:49] <branjb> it would have been even more awesome if it was a marketing sales pitch
[13:36:15] <z64555> what would it be selling, life insurance? lol
[13:36:22] <branjb> lol
[13:37:55] <branjb> for the job i have now, i brought a quadcopter i had built/coded from scratch to show as a project. the guy interviewing me wanted to see how well it held position on its own in a loiter, and i was so nervous i forgot to let the gps lock on. soon as i switched it to loiter, it took off straight in his direction
[13:37:58] <branjb> still got the job
[13:38:28] <z64555> great way to get his attention
[13:39:21] <branjb> it helped that it had a kill switch so it didn't hit him, and i knew/was able to explain exactly what happened and then demenstrate it correctly haha
[13:40:26] <branjb> so to get to a goal position in a desired orientation, i basically need to start out going on a reciprical to the desired orientation right? is that how it's generally done?
[13:41:26] <branjb> ie, i want to get to position 50,50 with orientation 135. so start out going -45, then correct towards 50,50
[13:42:38] <z64555> hm
[13:43:14] <branjb> i think that won't get me my exact desired orientation unless i go really far out on the reciprical
[13:44:24] <z64555> not sure what you mean by reciprical
[13:44:41] <z64555> At this point you're tracing a bezier
[13:46:40] <branjb> http://imgur.com/a/acZ6W
[13:47:01] <branjb> red is desired position and orientation, so the reciprical is starting out going on the opposite orientation and then correcting to goal
[13:47:22] <branjb> not sure if it would work or just get me close
[13:47:45] <branjb> basically the vertex of the parabola would be a way point
[13:48:19] <z64555> nah, you don't need another point, you can get it with just the start and end points
[13:50:36] <z64555> well, maybe, I'm just now looking at bezier implementation
[13:51:17] <branjb> I can always just pivot in place but that's lame
[13:54:54] <z64555> currently your system has a 3-point path, You need another point near the destination to get the desired angle, somehow
[13:55:42] <z64555> that much is clear, but the trick is to how to implement taht into your current PID control system without resorting to a complete overhaul
[13:57:28] <branjb> could just put a point 1m off in the opposite direction of desired orientation, and when it's reached then proceed to goal
[13:58:51] <z64555> ah, almost
[13:59:08] <branjb> i have an array of IR sensors around it, eventually i want to navigate around objects so i'll need to figure out logic for how to control waypoints anyway
[13:59:14] <z64555> Yeah, you can put a control point in the direction of the path, some distance away from the end point
[13:59:31] <z64555> Once the bot seaks to it's angle, it'll advance to the end point
[13:59:38] <justanotheruser> Is there any reason to not use a stepper servo + 10:1 gearbox for a robot arm?
[13:59:56] <z64555> justanotheruser: dunno, sorry
[13:59:58] <justanotheruser> I am not too concerned with speed, it is 1500rpm, 150rpm seems sufficient
[14:03:14] <z64555> branjb: It wouldn't be a positional waypoint, but rather an angular waypoint
[14:03:38] <branjb> ohh, i see what you mean
[14:03:52] <branjb> and when theta = desired orientation, then continue to final goal
[14:03:56] <z64555> yes
[14:04:15] <z64555> So, you have an end point, and a seek point
[14:04:31] <z64555> https://en.wikipedia.org/wiki/B%C3%A9zier_curve#/media/File:Bezier_curve.svg
[14:04:37] <z64555> Which would be P2
[14:05:11] <z64555> P0 is your robot's position, P3 is your end position, and P1 is from your robot's initial orientation and physics
[14:05:59] <z64555> Your current system is quadratic, which has P0, P1, and P3
[14:06:49] <z64555> P1 is unknown, but shouldn't matter too much
[14:11:55] <z64555> and, tbh, this is something I've been thinking about as a pathing system for my quad, whenever I get around to making it fly. :)
[14:12:31] <z64555> I've got all the hardware for it, but I've been derping about, being stubborn to not learn how to code the poor thing
[14:13:14] <branjb> quads are pretty easy, there's hundreds of open source flight controllers you can reference to see how certain things are accomplished
[14:13:37] <branjb> well, dozens
[14:14:05] <z64555> generally for the same hardware platform tho
[14:14:15] <z64555> the atmel chips
[14:14:17] <branjb> yeah, algorithms are similar
[14:14:26] <branjb> there are a lot of STM32 based ones now too
[14:15:15] <z64555> I've got my own system designed, and got mid-level code made, but having trouble compiling and getting it onto the hardware, which is new to me
[14:15:29] <z64555> It's a TI stellaris, LM4F120XL
[14:15:51] <z64555> the line is under a different name, but it's generally the same thing
[14:16:41] <z64555> the other board I have is a more power hungry chip, and significantly older, a MiniDragon+, an HC9S12 chip
[14:22:30] <branjb> I like the TI microcontrollers
[14:56:03] <z64555> hm
[14:56:17] <z64555> branjb: the position of P2 should probably have some effect on your PID gains
[14:58:19] <z64555> or, perhaps, the velocity
[14:58:33] <z64555> yes, velocity would make sense
[16:29:03] <codepython777> anyone around?
[16:42:07] <z64555> no, just a bunch of sqaures
[16:42:15] <codepython777> :)
[17:21:46] <gmct> https://p3d.in/LuMiw
[17:21:47] <gmct> How does this look?
[17:21:49] <gmct> https://p3d.in/LuMiw
[17:22:10] <gmct> Stepper motor attachment for Rubik's cube robot.
[19:52:24] <rue_shop3> popular mechanics, Jan 1965, how to cut dovetails on a lathe
[22:06:39] <rue_shop3> hmm
[22:06:44] <rue_shop3> usb over ethernet
[22:15:46] <justanotheruser> what are your thoughts on this motor + a 10:1 gearbox for a robo arm http://www.ebay.com/itm/NEMA34-Hybrid-Stepper-Servo-Closed-Loop-Motor-Drive-12NM-86J18156EC-1000-2HSS86H-/121787201520?hash=item1c5b1537f0:g:y2AAAOSwPCVYBJ-a&autorefresh=true
[22:38:34] * z64555 pokes the rue_shop3
[22:39:02] <rue_shop3> WHY WITH THE POKING
[22:39:22] * rue_shop3 goes back to sleep
[22:39:31] <z64555> lol, but you were awake
[22:40:39] <z64555> gmct: looks good
[22:46:16] <rue_shop3> is there any point in staying awake till 2am tonight?
[22:50:58] <justanotheruser> rue_shop3: for what
[22:52:15] <rue_shop3> life
[22:58:11] <justanotheruser> do gearboxes tend to work at most reasonable torques?
[23:01:40] <justanotheruser> why are they so expensive
[23:02:47] <Snert__> make a list. throw away the ones you can't afford anyways.
[23:03:00] <Snert__> but the most torque ya can for what you can afford.
[23:03:06] <Snert__> buy
[23:03:19] <Snert__> ... and try it out.
[23:03:28] <justanotheruser> wat