rotor 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/rotor/gcode.rb +34 -24
- data/lib/rotor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 514bde73c602619ea83893fca22097539fbb8e95
|
4
|
+
data.tar.gz: b948b19e6d5faa4b1abcfadfaa0d4c7bc0d12aab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 766ce6e59e93fd306361d83d8fcbbf02ebf2d59235422feb6e34cc7dffbb3b2e3b5c6691d10957a6bbe7344ec83d2bf6f5fafb24bdf261631228fca156c14f0a
|
7
|
+
data.tar.gz: 01203a2ce658cc37374ae69ce9e6fe7ea937ad7be6d8fe670befb4b865ce0c60828fbb2b1b4421989f5fb0b71d557f6471b6fe8e1bf78114dd272b0c62501413
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
Rotor (Ruby Motor)
|
2
2
|
==================
|
3
3
|
|
4
|
+
Version 0.1.7
|
5
|
+
-------------
|
6
|
+
|
7
|
+
Updated GCode Simulator to take into account various movement delays. For example,
|
8
|
+
|
9
|
+
- X moves 10 steps
|
10
|
+
- Y moves 100 steps
|
11
|
+
- Delays are the same
|
12
|
+
|
13
|
+
X would have finished it's movement much faster than Y.
|
14
|
+
|
15
|
+
Now, the delay will be automatically adjusted for the maximum movement and will start
|
16
|
+
and now end at the same time (hopefully).
|
17
|
+
|
18
|
+
Updated GCode Simulator to add a small delay for Z Movement (500 * Delay) milliseconds to allow time for puncture.
|
19
|
+
|
4
20
|
Version 0.1.6
|
5
21
|
-------------
|
6
22
|
|
data/lib/rotor/gcode.rb
CHANGED
@@ -115,62 +115,72 @@ module Rotor
|
|
115
115
|
@x_move = parsed_line[:x]
|
116
116
|
@x_move ||= 0
|
117
117
|
@x_move *= @scale
|
118
|
-
|
119
118
|
@x_movement = (@x_move - @x).abs
|
119
|
+
@x = @x_move
|
120
|
+
end
|
121
|
+
|
122
|
+
@y_move = nil
|
123
|
+
if parsed_line[:y]
|
124
|
+
@y_move = parsed_line[:y]
|
125
|
+
@y_move ||= 0
|
126
|
+
@y_move *= @scale
|
127
|
+
@y_movement = (@y_move - @y).abs
|
128
|
+
@y = @y_move
|
129
|
+
end
|
130
|
+
|
131
|
+
@z_move = nil
|
132
|
+
if parsed_line[:z]
|
133
|
+
@z_move = parsed_line[:z]
|
134
|
+
@z_move ||= 0
|
135
|
+
@z_move *= @scale
|
136
|
+
@z_movement = (@z_move - @z).abs
|
137
|
+
@z = @z_move
|
138
|
+
end
|
139
|
+
|
140
|
+
comp_delay_calc = [@x_movement,@y_movement,@z_movement].max
|
120
141
|
|
142
|
+
if parsed_line[:x]
|
143
|
+
x_delay = comp_delay_calc * delay / @x_movement
|
121
144
|
if @x_move.to_f < @x #move to the right
|
122
145
|
if @stepper_x # && @stepper_x.at_safe_area?
|
123
|
-
threads << Thread.new { @stepper_x.forward(
|
146
|
+
threads << Thread.new { @stepper_x.forward(x_delay, @x_movement) }
|
124
147
|
end
|
125
148
|
elsif @x_move.to_f > @x #move to the left
|
126
149
|
if @stepper_x # && @stepper_x.at_safe_area?
|
127
|
-
threads << Thread.new { @stepper_x.backwards(
|
150
|
+
threads << Thread.new { @stepper_x.backwards(x_delay, @x_movement) }
|
128
151
|
end
|
129
152
|
end unless @x_movement == 0
|
130
|
-
@x = @x_move
|
131
153
|
end
|
132
154
|
|
133
|
-
@y_move = nil
|
134
155
|
if parsed_line[:y]
|
135
|
-
|
136
|
-
@y_move ||= 0
|
137
|
-
@y_move *= @scale
|
138
|
-
|
139
|
-
@y_movement = (@y_move - @y).abs
|
140
|
-
|
156
|
+
y_delay = comp_delay_calc * delay / @y_movement
|
141
157
|
if @y_move.to_f < @y #move to the right
|
142
158
|
if @stepper_y # && @stepper_y.at_safe_area?
|
143
|
-
threads << Thread.new { @stepper_y.forward(
|
159
|
+
threads << Thread.new { @stepper_y.forward(y_delay, @y_movement) }
|
144
160
|
end
|
145
161
|
elsif @y_move.to_f > @y #move to the left
|
146
162
|
if @stepper_y # && @stepper_y.at_safe_area?
|
147
|
-
threads << Thread.new { @stepper_y.backwards(
|
163
|
+
threads << Thread.new { @stepper_y.backwards(y_delay, @y_movement) }
|
148
164
|
end
|
149
165
|
end unless @y_movement == 0
|
150
|
-
@y = @y_move
|
151
166
|
end
|
152
167
|
|
153
|
-
@z_move = nil
|
154
168
|
if parsed_line[:z]
|
155
|
-
|
156
|
-
@z_move ||= 0
|
157
|
-
@z_move *= @scale
|
158
|
-
|
159
|
-
@z_movement = (@z_move - @z).abs
|
160
|
-
|
169
|
+
z_delay = comp_delay_calc * delay / @z_movement
|
161
170
|
if @z_move.to_f > @z #move to the right
|
162
171
|
if @stepper_z # && @stepper_z.at_safe_area?
|
163
|
-
threads << Thread.new { @stepper_z.forward(
|
172
|
+
threads << Thread.new { @stepper_z.forward(z_delay, @z_movement) }
|
164
173
|
end
|
165
174
|
elsif @z_move.to_f < @z #move to the left
|
166
175
|
if @stepper_z # && @stepper_z.at_safe_area?
|
167
|
-
threads << Thread.new { @stepper_z.backwards(
|
176
|
+
threads << Thread.new { @stepper_z.backwards(z_delay, @z_movement) }
|
168
177
|
end
|
169
178
|
end unless @z_movement == 0
|
170
|
-
@z = @z_move
|
171
179
|
end
|
172
180
|
puts "Moving to G#{parsed_line[:g]} #{@x_move}(#{@x_movement}), #{@y_move}(#{@y_movement}), #{@z_move}(#{@z_movement})"
|
181
|
+
sleep (delay * 500) if @x_move == 0.0 && @y_move == 0.0 && @z_move > 0.0
|
173
182
|
threads.each { |thr| thr.join }
|
183
|
+
sleep (delay * 500) if @x_move == 0.0 && @y_move == 0.0 && @z_move > 0.0
|
174
184
|
File.open("output.txt", 'a') { |file| file.write("#{@x_move},#{@y_move},#{@z_move},#{@x_movement},#{@y_movement},#{@z_movement}\n") } if File.exists?("output.txt")
|
175
185
|
end
|
176
186
|
|
data/lib/rotor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rotor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobaltz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|