rotor 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e48e610c2097d68d9a98bbf70151730a9957875
4
- data.tar.gz: be5914357afb26ab29806eb649f1f00196fa8267
3
+ metadata.gz: f6a9f96abcefc34dafec5fbb7e2b42001a914a3c
4
+ data.tar.gz: 9cafb0d441b1ca31778ee344d3740f5aa3021d8a
5
5
  SHA512:
6
- metadata.gz: c35be0d4fbde64f072d1405913058437be150c37842f42afbd24a50df9f4258089d23c9801d6d877cfa1c95e02a375db2f2feaa67da2716a5f889910ba9a69e5
7
- data.tar.gz: e00420f6330260ee0bf2f5ec49e0e84d60fc8ea78457610ae0cc7536f38bab87e087a12982822ea5b2532d9f3928879937df20b2658980d4d94351e4a8ce9916
6
+ metadata.gz: 55aae03f77e9c557d2753f52be0c59153fce2d3b70b9c88bfa14e0b41e23192945c5be829dd34be171bf597d28e80f835cafff3e150b7acd8d45d6cf6013ca80
7
+ data.tar.gz: e08346a466a3f9ac1b24da19e2759c7451631f0e28515ec8577410b44ec1cec478447fc107fd944122cb41fc322740af9e849d24bf3dc316052ea81de258d3d7
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ Rotor (Ruby Motor)
2
+ ==================
3
+
4
+ Version 0.1.6
5
+ -------------
6
+
7
+ The GCode Module now has an option to specify the G0 Fast Move speed.
8
+
9
+ Rotor::Gcode.new(stepper_x=nil,stepper_y=nil,stepper_z=nil,scale=1,servo=nil,fast_move=1)
10
+
11
+ gcode = Rotor::Gcode.new(stepper_x,stepper_y,stepper_z,1,servo,1)
12
+
13
+ Updated the README with new examples and updated documentation.
data/README.md CHANGED
@@ -162,8 +162,13 @@ Enter each stepper motor (or nil if you do not have that particular axis) along
162
162
  with the scale (multiplies all coordinates by this. Typically you will keep this
163
163
  at 1).
164
164
 
165
+ The last variable is the speed in which G0 will move. Typically, this move should
166
+ be faster than your normal movement speed.
167
+
168
+ Rotor::Gcode.new(stepper_x=nil,stepper_y=nil,stepper_z=nil,scale=1,servo=nil,fast_move=1)
169
+
165
170
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166
- #gcode = Rotor::Gcode.new(stepper_x,stepper_y,stepper_z,1,servo)
171
+ #gcode = Rotor::Gcode.new(stepper_x,stepper_y,stepper_z,1,servo,1)
167
172
  gcode = Rotor::Gcode.new(nil,nil,nil,1,nil)
168
173
  gcode.open('sample.nc')
169
174
  gcode.simulate(accuracy=8,speed=1)
@@ -201,34 +206,27 @@ Here is the real world sample code that I am using to plot
201
206
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202
207
  require 'rotor'
203
208
  begin
204
- stepper_x = Rotor::Stepper.new(23,12,17,24,nil,13,0,157.48)
205
- stepper_y = Rotor::Stepper.new(25, 4,21,22,nil,19,0,157.48)
206
- servo = Rotor::Servo.new(18)
207
-
208
- stepper_x.set_home(:backwards)
209
- stepper_y.set_home(:backwards)
210
-
211
- #My threaded rods move 1 inch per 4000 steps (Stepper Motor has 200 steps/rev and the rod has 20 threads per inch)
212
-
213
- stepper_x.forward(1,40)
214
- stepper_y.forward(1,40)
215
-
216
- gcode = Rotor::Gcode.new(stepper_x,stepper_y,nil,1,servo)
209
+ stepper_x = Rotor::Stepper.new(23,12,17,24,nil,13 ,0,157.48)
210
+ stepper_y = Rotor::Stepper.new(25, 4,21,22,nil,19 ,0,157.48)
211
+ stepper_z = Rotor::Stepper.new(16,20, 6,26,nil,nil,0,157.48)
212
+ puts "Moving to home and soft origin"
213
+ stepper_z.forward(1,10)
214
+ stepper_x.set_home(:forward)
215
+ stepper_y.set_home(:forward)
216
+ stepper_x.backwards(2,120)
217
+ stepper_y.backwards(2,70)
218
+ stepper_z.backwards(1,10)
219
+ puts "Running Code"
220
+
221
+ gcode = Rotor::Gcode.new(stepper_x,stepper_y,stepper_z,1,nil,1.5)
217
222
  gcode.open('output.nc')
218
- gcode.simulate(accuracy=8,speed=5)
223
+ gcode.simulate(16,5)
219
224
 
220
225
  ensure
221
- servo.rotate(:up)
222
-
223
- stepper_x.set_home(:backwards)
224
- stepper_y.set_home(:backwards)
225
- stepper_x.forward(1,4000)
226
- stepper_y.forward(1,4000)
227
-
228
226
  stepper_x.power_down
229
227
  stepper_y.power_down
230
-
231
- [23,12,17,24,13,25,4,21,22,19,13].each do |pin|
228
+ stepper_z.power_down
229
+ [23,12,17,24,13,25,4,21,22,19,13,16,20,6,26].each do |pin|
232
230
  `echo #{pin} > /sys/class/gpio/unexport`
233
231
  end
234
232
  end
@@ -255,7 +253,7 @@ marker is entering into an object.
255
253
 
256
254
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
257
255
  File.open("output.txt", 'wb') { |file| file.write("x,y,xm,ym\n") }
258
- gcode = Rotor::Gcode.new(nil,nil,nil,1,nil)
256
+ gcode = Rotor::Gcode.new(nil,nil,nil,1,nil,1)
259
257
  gcode.open('output.nc')
260
258
  gcode.simulate
261
259
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
data/lib/rotor/gcode.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module Rotor
2
2
  class Gcode
3
- def initialize(stepper_x=nil,stepper_y=nil,stepper_z=nil,scale=1,servo=nil)
3
+ def initialize(stepper_x=nil,stepper_y=nil,stepper_z=nil,scale=1,servo=nil,fast_move=1)
4
4
  @stepper_x = stepper_x
5
5
  @stepper_y = stepper_y
6
6
  @stepper_z = stepper_z
7
+ @fast_move = fast_move
7
8
  @scale = scale
8
9
  @servo = servo
9
10
  end
@@ -26,33 +27,11 @@ module Rotor
26
27
  if parsed_line[:g]
27
28
  #Move to this origin point.
28
29
  if parsed_line[:g] == 0
29
- if parsed_line[:z] && parsed_line[:f] && parsed_line[:x].nil? && parsed_line[:y].nil?
30
- puts "Lowering marker"
31
- @servo.rotate(:down) if @servo
32
- @stepper_z.forward(5,25) if @stepper_z
33
- elsif parsed_line[:z] && parsed_line[:f].nil? && parsed_line[:x].nil? && parsed_line[:y].nil?
34
- puts "Raising marker::#{parsed_line}"
35
- @stepper_z.backwards(5,25) if @stepper_z
36
- @servo.rotate(:up) if @servo
37
- else
38
- puts "Move Stepper::#{parsed_line}"
39
- move_stepper(parsed_line,speed)
40
- end
30
+ puts "Move Stepper::#{parsed_line}"
31
+ move_stepper(parsed_line,@fast_move)
41
32
  elsif parsed_line[:g] == 1
42
- if parsed_line[:z] && parsed_line[:f] && parsed_line[:x].nil? && parsed_line[:y].nil?
43
- puts "Lowering marker"
44
- @servo.rotate(:down) if @servo
45
- @stepper_z.forward(5,25) if @stepper_z
46
- elsif parsed_line[:z] && parsed_line[:f].nil? && parsed_line[:x].nil? && parsed_line[:y].nil?
47
- puts "Raising marker::#{parsed_line}"
48
- @stepper_z.backwards(5,25) if @stepper_z
49
- @servo.rotate(:up) if @servo
50
- elsif parsed_line[:z].nil? && parsed_line[:f] && parsed_line[:x].nil? && parsed_line[:y].nil?
51
- # Set feed/spin rate
52
- else
53
- puts "Move Stepper::#{parsed_line}"
54
- move_stepper(parsed_line,speed)
55
- end
33
+ puts "Move Stepper::#{parsed_line}"
34
+ move_stepper(parsed_line,speed)
56
35
  elsif parsed_line[:g] == 2 || parsed_line[:g] == 3
57
36
  # Get my ARC on
58
37
  ignore = false
@@ -147,7 +126,7 @@ module Rotor
147
126
  if @stepper_x # && @stepper_x.at_safe_area?
148
127
  threads << Thread.new { @stepper_x.backwards(delay, @x_movement) }
149
128
  end
150
- end
129
+ end unless @x_movement == 0
151
130
  @x = @x_move
152
131
  end
153
132
 
@@ -167,7 +146,7 @@ module Rotor
167
146
  if @stepper_y # && @stepper_y.at_safe_area?
168
147
  threads << Thread.new { @stepper_y.backwards(delay, @y_movement) }
169
148
  end
170
- end
149
+ end unless @y_movement == 0
171
150
  @y = @y_move
172
151
  end
173
152
 
@@ -179,20 +158,20 @@ module Rotor
179
158
 
180
159
  @z_movement = (@z_move - @z).abs
181
160
 
182
- if @z_move.to_f < @z #move to the right
161
+ if @z_move.to_f > @z #move to the right
183
162
  if @stepper_z # && @stepper_z.at_safe_area?
184
163
  threads << Thread.new { @stepper_z.forward(delay, @z_movement) }
185
164
  end
186
- elsif @z_move.to_f > @z #move to the left
165
+ elsif @z_move.to_f < @z #move to the left
187
166
  if @stepper_z # && @stepper_z.at_safe_area?
188
167
  threads << Thread.new { @stepper_z.backwards(delay, @z_movement) }
189
168
  end
190
- end
169
+ end unless @z_movement == 0
191
170
  @z = @z_move
192
171
  end
193
172
  puts "Moving to G#{parsed_line[:g]} #{@x_move}(#{@x_movement}), #{@y_move}(#{@y_movement}), #{@z_move}(#{@z_movement})"
194
173
  threads.each { |thr| thr.join }
195
- File.open("output.txt", 'a') { |file| file.write("#{@x_move},#{@y_move},#{@x_movement},#{@y_movement}\n") } if File.exists?("output.txt")
174
+ 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")
196
175
  end
197
176
 
198
177
  def parse_line(line)
data/lib/rotor/stepper.rb CHANGED
@@ -61,8 +61,8 @@ module Rotor
61
61
  puts "Setting #{direction} with Homing on GPIO #{@homing_switch}"
62
62
  @move = true
63
63
  while @move == true
64
- backwards(1,1) if direction == :backwards && @io.read(@homing_switch) == @homing_normally
65
- forward(1,1) if direction == :forward && @io.read(@homing_switch) == @homing_normally
64
+ backwards(1.5,1) if direction == :backwards && @io.read(@homing_switch) == @homing_normally
65
+ forward(1.5,1) if direction == :forward && @io.read(@homing_switch) == @homing_normally
66
66
  @move = false unless @io.read(@homing_switch) == @homing_normally
67
67
  end
68
68
  end
data/lib/rotor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rotor
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - kobaltz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-28 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,6 +60,7 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
+ - CHANGELOG.md
63
64
  - Gemfile
64
65
  - LICENSE.txt
65
66
  - README.md