Date: | 2015-07-23 01:15:45 (8 years 2 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 4153e6b4e2c14bcb4f0cbcb46ac3d5f5393bf718 |
Message: | gp2rml/gp2rml.c (output_paths): use PA when possible; correct speed
calculation The mill uses the Z speed for the entire !ZZ movement, whether there is a Z component or not. We now issue PA instead of !ZZ when moving horizontally. Also adapted the speed calculating accordingly. |
Files: |
gp2rml/gp2rml.c (2 diffs) |
Change Details
gp2rml/gp2rml.c | ||
---|---|---|
133 | 133 | const struct segment *seg; |
134 | 134 | double x = 0, y = 0, z = 0; |
135 | 135 | double d, s = 0, t = 0; |
136 | double txy, tz; | |
136 | double speed; | |
137 | 137 | |
138 | 138 | printf("IN;!MC1;PA\n"); |
139 | 139 | printf("!ZO%d;!PZ0,%d;PU\n", units(z_max), units(z_clear)); |
... | ... | |
156 | 156 | z = seg->z; |
157 | 157 | seg = seg->next; |
158 | 158 | while (seg) { |
159 | printf("!ZZ%d,%d,%d\n", units(seg->x), units(seg->y), | |
160 | units((seg->z - z_max) * z_scale)); | |
159 | if (path->segments->z == z && z == seg->z) { | |
160 | printf("PA%d,%d\n", | |
161 | units(seg->x), units(seg->y)); | |
162 | speed = xy_speed; | |
163 | } else { | |
164 | printf("!ZZ%d,%d,%d\n", | |
165 | units(seg->x), units(seg->y), | |
166 | units((seg->z - z_max) * z_scale)); | |
167 | speed = z_speed; | |
168 | } | |
161 | 169 | d = hypot(x - seg->x, y - seg->y); |
162 | txy = d / xy_speed; | |
163 | tz = fabs(z - seg->z) / z_speed; | |
164 | t += txy > tz ? txy : tz; | |
165 | 170 | d = hypot(d, z - seg->z); |
171 | t += d / speed; | |
166 | 172 | s += d; |
167 | 173 | x = seg->x; |
168 | 174 | y = seg->y; |
Branches:
master