Hello I built a polar sand art table very similar to this: too new to include link.
I have it running but the files are not playing correctly. The code in his github he links is not converting the theta, rho files correctly I don’t think. Here is the file that actually does the conversion: too new to include link.
I need to convert theta rho to number of linear steps for a stepper motor and number of rotational steps; and also add the correct delays.
I am hoping for help with understanding how the conversion is done. What does this mean?
microstep_size = 4
max_disp = 7300
coors = np.array([0, 0])
for c in lines:
c = c.split(" ")
theta = float(c[0])
r = float(c[1])
if (theta != 0 or r != 0):
theta = int(microstep_size * 3200 * theta / 6.28318531)
r = int(max_disp * r)
coors = np.vstack((coors, [theta, r]))
min_value = coors[1:, 0].min()
coors[1:, 0] -= min_value
return coors
I believe that is where the conversion happens? why is the number 3200 here?
microstep_size * 3200 * theta
Is it a random choice? Any help would be awesome!!
I am not sure where you are pointing to. These filters help with spam, but you have to view a few posts to be able to link. If you put the address in a different format, I can edit it.
This is a post where I worked out converting theta, rho from sandify to XY angles. I picked an arbitrary unit if 6 per rotation just to make the numbers look sort of like radians:
my table works the exact same way as the table I linked, with a rotational stepper motor and a linear stepper motor. I am able to calculate the number of steps for the radius with a switch on each end.
So I am assuming in the code the max_disp is supposed to be the number of steps my radius is but then it doesnt make sense to me. Here is a simple theta rho circle I exported using your sandify website:
[1.57080 1.00000]
And here is the converted file based on the github file I linked, after I changed my max_disp to be 50,000.:
[0 50000 -1.0 0.0001]
And here is the part of the code that uses those coordinates:
theta/6.28(2pi) is converting the theta value to number of full rotations. In theta,rho, a theta of 10 pi means 5 full rotations.
So then it is multiplying by 3200 my guess there is that the steppers are 200 steps / rotation. And there maybe is a 1:16 gear reduction. Then the drivers are set to 4 microsteps / full step.
I think you are exactly right. I have 1.8 deg stepper motors so 200 steps/rotation. The 1:16 gear reduction I am not totally sure, I have a 20 tooth pulley on the rotational motor which is connected to a 320 tooth (I believe) gear.
What does all that mean in regards to the math though? Because when I try to export and convert a simple 5 sided polygon with theta rho it doesn’t play right at all
Does that part make sense? If I just simply change the min_delay = 0.001 to something like 0.000001 will that just speed up the whole drawing or will it change other things and make it draw the wrong shapes?
This is where it is subtracting the min. I am on my phone right now, so I can’t poke too much more at this. I am not sure the motivation, but I suspect that is to keep wild starting positions from making the ball take off to get started, but I don’t know.
I also noticed that the first coord is always 0,0 and the processing code skips anything that has theta and rho equal to zero. So it makes sense that it wouldn’t be different by adding 0,0 to the front.
I think this is saying, “go to zero with a -1 delay (which doesn’t do anything)” and “go to 50,000 microsteps with a 0.001s delay between steps”. Which should be moving the radius out 50k microsteps.
I do think you need to start a pattern near zero. It seems to be assuming the radius, at least, starts at the center. I could be wrong, but that is what my tea leaves are telling me.
Yeah, that makes sense. The theta rho considers a rho of 1.0 to be at the max radius and zero in the center. So multiplying rho by the number of microsteps needed to get from zero to max radius would make sense to me.