tinkerforge 2.1.11 → 2.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +31 -9
- data/lib/tinkerforge/brick_imu.rb +62 -40
- data/lib/tinkerforge/brick_imu_v2.rb +70 -42
- data/lib/tinkerforge/brick_master.rb +47 -23
- data/lib/tinkerforge/brick_red.rb +3 -3
- data/lib/tinkerforge/brick_servo.rb +40 -18
- data/lib/tinkerforge/brick_silent_stepper.rb +829 -0
- data/lib/tinkerforge/brick_stepper.rb +47 -25
- data/lib/tinkerforge/bricklet_accelerometer.rb +11 -11
- data/lib/tinkerforge/bricklet_ambient_light.rb +12 -12
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +8 -8
- data/lib/tinkerforge/bricklet_analog_in.rb +18 -18
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +15 -15
- data/lib/tinkerforge/bricklet_analog_out.rb +3 -3
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +3 -3
- data/lib/tinkerforge/bricklet_barometer.rb +19 -19
- data/lib/tinkerforge/bricklet_can.rb +20 -7
- data/lib/tinkerforge/bricklet_co2.rb +14 -14
- data/lib/tinkerforge/bricklet_color.rb +19 -19
- data/lib/tinkerforge/bricklet_current12.rb +16 -16
- data/lib/tinkerforge/bricklet_current25.rb +15 -15
- data/lib/tinkerforge/bricklet_distance_ir.rb +14 -14
- data/lib/tinkerforge/bricklet_distance_us.rb +9 -9
- data/lib/tinkerforge/bricklet_dual_button.rb +5 -5
- data/lib/tinkerforge/bricklet_dual_relay.rb +13 -13
- data/lib/tinkerforge/bricklet_dust_detector.rb +11 -11
- data/lib/tinkerforge/bricklet_gps.rb +21 -21
- data/lib/tinkerforge/bricklet_hall_effect.rb +12 -10
- data/lib/tinkerforge/bricklet_humidity.rb +21 -21
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +3 -3
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +4 -4
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +4 -4
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +6 -6
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +6 -6
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +5 -5
- data/lib/tinkerforge/bricklet_io16.rb +5 -5
- data/lib/tinkerforge/bricklet_io4.rb +5 -5
- data/lib/tinkerforge/bricklet_joystick.rb +16 -16
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +99 -30
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +5 -5
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +5 -5
- data/lib/tinkerforge/bricklet_led_strip.rb +3 -3
- data/lib/tinkerforge/bricklet_line.rb +12 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +21 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +10 -10
- data/lib/tinkerforge/bricklet_moisture.rb +12 -12
- data/lib/tinkerforge/bricklet_motion_detector.rb +5 -5
- data/lib/tinkerforge/bricklet_multi_touch.rb +3 -3
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +20 -20
- data/lib/tinkerforge/bricklet_oled_128x64.rb +7 -7
- data/lib/tinkerforge/bricklet_oled_64x48.rb +6 -6
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +4 -4
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +5 -5
- data/lib/tinkerforge/bricklet_ptc.rb +21 -21
- data/lib/tinkerforge/bricklet_real_time_clock.rb +7 -7
- data/lib/tinkerforge/bricklet_remote_switch.rb +3 -3
- data/lib/tinkerforge/bricklet_rgb_led.rb +3 -3
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +6 -6
- data/lib/tinkerforge/bricklet_rotary_poti.rb +23 -23
- data/lib/tinkerforge/bricklet_rs232.rb +19 -16
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +5 -5
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_sound_intensity.rb +13 -12
- data/lib/tinkerforge/bricklet_temperature.rb +12 -12
- data/lib/tinkerforge/bricklet_temperature_ir.rb +30 -30
- data/lib/tinkerforge/bricklet_thermocouple.rb +13 -13
- data/lib/tinkerforge/bricklet_tilt.rb +3 -3
- data/lib/tinkerforge/bricklet_uv_light.rb +10 -10
- data/lib/tinkerforge/bricklet_voltage.rb +18 -18
- data/lib/tinkerforge/bricklet_voltage_current.rb +23 -23
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
data/lib/tinkerforge/brick_dc.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
@@ -38,8 +38,8 @@ module Tinkerforge
|
|
38
38
|
|
39
39
|
# This callback is triggered whenever a set velocity is reached. For example:
|
40
40
|
# If a velocity of 0 is present, acceleration is set to 5000 and velocity
|
41
|
-
# to 10000, CALLBACK_VELOCITY_REACHED will be triggered after about
|
42
|
-
# the set velocity is actually reached.
|
41
|
+
# to 10000, the CALLBACK_VELOCITY_REACHED callback will be triggered after about
|
42
|
+
# 2 seconds, when the set velocity is actually reached.
|
43
43
|
#
|
44
44
|
# .. note::
|
45
45
|
# Since we can't get any feedback from the DC motor, this only works if the
|
@@ -49,11 +49,11 @@ module Tinkerforge
|
|
49
49
|
CALLBACK_VELOCITY_REACHED = 23
|
50
50
|
|
51
51
|
# This callback is triggered with the period that is set by
|
52
|
-
# BrickDC#set_current_velocity_period. The parameter is the *current*
|
53
|
-
# used by the motor.
|
52
|
+
# BrickDC#set_current_velocity_period. The parameter is the *current*
|
53
|
+
# velocity used by the motor.
|
54
54
|
#
|
55
|
-
# CALLBACK_CURRENT_VELOCITY is only triggered after the set period
|
56
|
-
# a change in the velocity.
|
55
|
+
# The CALLBACK_CURRENT_VELOCITY callback is only triggered after the set period
|
56
|
+
# if there is a change in the velocity.
|
57
57
|
CALLBACK_CURRENT_VELOCITY = 24
|
58
58
|
|
59
59
|
FUNCTION_SET_VELOCITY = 1 # :nodoc:
|
@@ -76,6 +76,7 @@ module Tinkerforge
|
|
76
76
|
FUNCTION_GET_DRIVE_MODE = 18 # :nodoc:
|
77
77
|
FUNCTION_SET_CURRENT_VELOCITY_PERIOD = 19 # :nodoc:
|
78
78
|
FUNCTION_GET_CURRENT_VELOCITY_PERIOD = 20 # :nodoc:
|
79
|
+
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
79
80
|
FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
|
80
81
|
FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
|
81
82
|
FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
|
@@ -86,6 +87,14 @@ module Tinkerforge
|
|
86
87
|
|
87
88
|
DRIVE_MODE_DRIVE_BRAKE = 0 # :nodoc:
|
88
89
|
DRIVE_MODE_DRIVE_COAST = 1 # :nodoc:
|
90
|
+
COMMUNICATION_METHOD_NONE = 0 # :nodoc:
|
91
|
+
COMMUNICATION_METHOD_USB = 1 # :nodoc:
|
92
|
+
COMMUNICATION_METHOD_SPI_STACK = 2 # :nodoc:
|
93
|
+
COMMUNICATION_METHOD_CHIBI = 3 # :nodoc:
|
94
|
+
COMMUNICATION_METHOD_RS485 = 4 # :nodoc:
|
95
|
+
COMMUNICATION_METHOD_WIFI = 5 # :nodoc:
|
96
|
+
COMMUNICATION_METHOD_ETHERNET = 6 # :nodoc:
|
97
|
+
COMMUNICATION_METHOD_WIFI_V2 = 7 # :nodoc:
|
89
98
|
|
90
99
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
91
100
|
# the IP Connection <tt>ipcon</tt>.
|
@@ -118,6 +127,7 @@ module Tinkerforge
|
|
118
127
|
@response_expected[CALLBACK_EMERGENCY_SHUTDOWN] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
119
128
|
@response_expected[CALLBACK_VELOCITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
120
129
|
@response_expected[CALLBACK_CURRENT_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
130
|
+
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
121
131
|
@response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
122
132
|
@response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
123
133
|
@response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -311,6 +321,18 @@ module Tinkerforge
|
|
311
321
|
send_request(FUNCTION_GET_CURRENT_VELOCITY_PERIOD, [], '', 2, 'S')
|
312
322
|
end
|
313
323
|
|
324
|
+
# Returns the timeout count for the different communication methods.
|
325
|
+
#
|
326
|
+
# The methods 0-2 are available for all Bricks, 3-7 only for Master Bricks.
|
327
|
+
#
|
328
|
+
# This function is mostly used for debugging during development, in normal operation
|
329
|
+
# the counters should nearly always stay at 0.
|
330
|
+
#
|
331
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
332
|
+
def get_send_timeout_count(communication_method)
|
333
|
+
send_request(FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L')
|
334
|
+
end
|
335
|
+
|
314
336
|
# Enables the status LED.
|
315
337
|
#
|
316
338
|
# The status LED is the blue LED next to the USB connector. If enabled is is
|
@@ -371,7 +393,7 @@ module Tinkerforge
|
|
371
393
|
send_request(FUNCTION_RESET, [], '', 0, '')
|
372
394
|
end
|
373
395
|
|
374
|
-
# Returns the UID, the UID where the Brick is connected to,
|
396
|
+
# Returns the UID, the UID where the Brick is connected to,
|
375
397
|
# the position, the hardware and firmware version as well as the
|
376
398
|
# device identifier.
|
377
399
|
#
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
@@ -21,13 +21,13 @@ module Tinkerforge
|
|
21
21
|
CALLBACK_ACCELERATION = 31
|
22
22
|
|
23
23
|
# This callback is triggered periodically with the period that is set by
|
24
|
-
# BrickIMU#set_magnetic_field_period. The parameters are the magnetic
|
25
|
-
# for the x, y and z axis.
|
24
|
+
# BrickIMU#set_magnetic_field_period. The parameters are the magnetic
|
25
|
+
# field for the x, y and z axis.
|
26
26
|
CALLBACK_MAGNETIC_FIELD = 32
|
27
27
|
|
28
28
|
# This callback is triggered periodically with the period that is set by
|
29
|
-
# BrickIMU#set_angular_velocity_period. The parameters are the angular
|
30
|
-
# for the x, y and z axis.
|
29
|
+
# BrickIMU#set_angular_velocity_period. The parameters are the angular
|
30
|
+
# velocity for the x, y and z axis.
|
31
31
|
CALLBACK_ANGULAR_VELOCITY = 33
|
32
32
|
|
33
33
|
# This callback is triggered periodically with the period that is set by
|
@@ -81,6 +81,7 @@ module Tinkerforge
|
|
81
81
|
FUNCTION_ORIENTATION_CALCULATION_ON = 37 # :nodoc:
|
82
82
|
FUNCTION_ORIENTATION_CALCULATION_OFF = 38 # :nodoc:
|
83
83
|
FUNCTION_IS_ORIENTATION_CALCULATION_ON = 39 # :nodoc:
|
84
|
+
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
84
85
|
FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
|
85
86
|
FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
|
86
87
|
FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
|
@@ -95,6 +96,14 @@ module Tinkerforge
|
|
95
96
|
CALIBRATION_TYPE_MAGNETOMETER_BIAS = 3 # :nodoc:
|
96
97
|
CALIBRATION_TYPE_GYROSCOPE_GAIN = 4 # :nodoc:
|
97
98
|
CALIBRATION_TYPE_GYROSCOPE_BIAS = 5 # :nodoc:
|
99
|
+
COMMUNICATION_METHOD_NONE = 0 # :nodoc:
|
100
|
+
COMMUNICATION_METHOD_USB = 1 # :nodoc:
|
101
|
+
COMMUNICATION_METHOD_SPI_STACK = 2 # :nodoc:
|
102
|
+
COMMUNICATION_METHOD_CHIBI = 3 # :nodoc:
|
103
|
+
COMMUNICATION_METHOD_RS485 = 4 # :nodoc:
|
104
|
+
COMMUNICATION_METHOD_WIFI = 5 # :nodoc:
|
105
|
+
COMMUNICATION_METHOD_ETHERNET = 6 # :nodoc:
|
106
|
+
COMMUNICATION_METHOD_WIFI_V2 = 7 # :nodoc:
|
98
107
|
|
99
108
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
100
109
|
# the IP Connection <tt>ipcon</tt>.
|
@@ -142,6 +151,7 @@ module Tinkerforge
|
|
142
151
|
@response_expected[FUNCTION_ORIENTATION_CALCULATION_ON] = RESPONSE_EXPECTED_FALSE
|
143
152
|
@response_expected[FUNCTION_ORIENTATION_CALCULATION_OFF] = RESPONSE_EXPECTED_FALSE
|
144
153
|
@response_expected[FUNCTION_IS_ORIENTATION_CALCULATION_ON] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
154
|
+
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
145
155
|
@response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
146
156
|
@response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
147
157
|
@response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -158,44 +168,44 @@ module Tinkerforge
|
|
158
168
|
@callback_formats[CALLBACK_QUATERNION] = 'e e e e'
|
159
169
|
end
|
160
170
|
|
161
|
-
# Returns the calibrated acceleration from the accelerometer for the
|
171
|
+
# Returns the calibrated acceleration from the accelerometer for the
|
162
172
|
# x, y and z axis in g/1000 (1g = 9.80665m/s²).
|
163
173
|
#
|
164
|
-
# If you want to get the acceleration periodically, it is recommended
|
165
|
-
# to use the callback
|
174
|
+
# If you want to get the acceleration periodically, it is recommended
|
175
|
+
# to use the CALLBACK_ACCELERATION callback and set the period with
|
166
176
|
# BrickIMU#set_acceleration_period.
|
167
177
|
def get_acceleration
|
168
178
|
send_request(FUNCTION_GET_ACCELERATION, [], '', 6, 's s s')
|
169
179
|
end
|
170
180
|
|
171
|
-
# Returns the calibrated magnetic field from the magnetometer for the
|
181
|
+
# Returns the calibrated magnetic field from the magnetometer for the
|
172
182
|
# x, y and z axis in mG (Milligauss or Nanotesla).
|
173
183
|
#
|
174
|
-
# If you want to get the magnetic field periodically, it is recommended
|
175
|
-
# to use the callback
|
184
|
+
# If you want to get the magnetic field periodically, it is recommended
|
185
|
+
# to use the CALLBACK_MAGNETIC_FIELD callback and set the period with
|
176
186
|
# BrickIMU#set_magnetic_field_period.
|
177
187
|
def get_magnetic_field
|
178
188
|
send_request(FUNCTION_GET_MAGNETIC_FIELD, [], '', 6, 's s s')
|
179
189
|
end
|
180
190
|
|
181
|
-
# Returns the calibrated angular velocity from the gyroscope for the
|
191
|
+
# Returns the calibrated angular velocity from the gyroscope for the
|
182
192
|
# x, y and z axis in °/14.375s (you have to divide by 14.375 to
|
183
193
|
# get the value in °/s).
|
184
194
|
#
|
185
|
-
# If you want to get the angular velocity periodically, it is recommended
|
186
|
-
# to use the callback
|
195
|
+
# If you want to get the angular velocity periodically, it is recommended
|
196
|
+
# to use the CALLBACK_ANGULAR_VELOCITY callback and set the period with
|
187
197
|
# BrickIMU#set_angular_velocity_period.
|
188
198
|
def get_angular_velocity
|
189
199
|
send_request(FUNCTION_GET_ANGULAR_VELOCITY, [], '', 6, 's s s')
|
190
200
|
end
|
191
201
|
|
192
|
-
# Returns the data from BrickIMU#get_acceleration, BrickIMU#get_magnetic_field
|
202
|
+
# Returns the data from BrickIMU#get_acceleration, BrickIMU#get_magnetic_field
|
193
203
|
# and BrickIMU#get_angular_velocity as well as the temperature of the IMU Brick.
|
194
204
|
#
|
195
205
|
# The temperature is given in °C/100.
|
196
206
|
#
|
197
|
-
# If you want to get the data periodically, it is recommended
|
198
|
-
# to use the callback
|
207
|
+
# If you want to get the data periodically, it is recommended
|
208
|
+
# to use the CALLBACK_ALL_DATA callback and set the period with
|
199
209
|
# BrickIMU#set_all_data_period.
|
200
210
|
def get_all_data
|
201
211
|
send_request(FUNCTION_GET_ALL_DATA, [], '', 20, 's s s s s s s s s s')
|
@@ -207,17 +217,17 @@ module Tinkerforge
|
|
207
217
|
#
|
208
218
|
# We recommend that you use quaternions instead.
|
209
219
|
#
|
210
|
-
# The order to sequence in which the orientation values should be applied is
|
211
|
-
# roll, yaw, pitch.
|
220
|
+
# The order to sequence in which the orientation values should be applied is
|
221
|
+
# roll, yaw, pitch.
|
212
222
|
#
|
213
|
-
# If you want to get the orientation periodically, it is recommended
|
214
|
-
# to use the callback
|
223
|
+
# If you want to get the orientation periodically, it is recommended
|
224
|
+
# to use the CALLBACK_ORIENTATION callback and set the period with
|
215
225
|
# BrickIMU#set_orientation_period.
|
216
226
|
def get_orientation
|
217
227
|
send_request(FUNCTION_GET_ORIENTATION, [], '', 6, 's s s')
|
218
228
|
end
|
219
229
|
|
220
|
-
# Returns the current orientation (x, y, z, w) of the IMU as
|
230
|
+
# Returns the current orientation (x, y, z, w) of the IMU as
|
221
231
|
# `quaternions <https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>`__.
|
222
232
|
#
|
223
233
|
# You can go from quaternions to Euler angles with the following formula::
|
@@ -226,12 +236,12 @@ module Tinkerforge
|
|
226
236
|
# yAngle = atan2(2*x*w - 2*y*z, 1 - 2*x*x - 2*z*z)
|
227
237
|
# zAngle = asin(2*x*y + 2*z*w)
|
228
238
|
#
|
229
|
-
# This process is not reversible, because of the
|
239
|
+
# This process is not reversible, because of the
|
230
240
|
# `gimbal lock <https://en.wikipedia.org/wiki/Gimbal_lock>`__.
|
231
241
|
#
|
232
|
-
# It is also possible to calculate independent angles. You can calculate
|
233
|
-
# yaw, pitch and roll in a right-handed vehicle coordinate system according to
|
234
|
-
# with::
|
242
|
+
# It is also possible to calculate independent angles. You can calculate
|
243
|
+
# yaw, pitch and roll in a right-handed vehicle coordinate system according to
|
244
|
+
# DIN70000 with::
|
235
245
|
#
|
236
246
|
# yaw = atan2(2*x*y + 2*w*z, w*w + x*x - y*y - z*z)
|
237
247
|
# pitch = -asin(2*w*y - 2*x*z)
|
@@ -245,14 +255,14 @@ module Tinkerforge
|
|
245
255
|
# [ 2*(x*z - w*y), 2*(y*z + w*x), 1 - 2*(x*x + y*y), 0],
|
246
256
|
# [ 0, 0, 0, 1]]
|
247
257
|
#
|
248
|
-
# If you want to get the quaternions periodically, it is recommended
|
249
|
-
# to use the callback
|
258
|
+
# If you want to get the quaternions periodically, it is recommended
|
259
|
+
# to use the CALLBACK_QUATERNION callback and set the period with
|
250
260
|
# BrickIMU#set_quaternion_period.
|
251
261
|
def get_quaternion
|
252
262
|
send_request(FUNCTION_GET_QUATERNION, [], '', 16, 'e e e e')
|
253
263
|
end
|
254
264
|
|
255
|
-
# Returns the temperature of the IMU Brick. The temperature is given in
|
265
|
+
# Returns the temperature of the IMU Brick. The temperature is given in
|
256
266
|
# °C/100.
|
257
267
|
def get_imu_temperature
|
258
268
|
send_request(FUNCTION_GET_IMU_TEMPERATURE, [], '', 2, 's')
|
@@ -294,10 +304,10 @@ module Tinkerforge
|
|
294
304
|
send_request(FUNCTION_GET_MAGNETOMETER_RANGE, [], '', 1, 'C')
|
295
305
|
end
|
296
306
|
|
297
|
-
# Sets the convergence speed of the IMU Brick in °/s. The convergence speed
|
307
|
+
# Sets the convergence speed of the IMU Brick in °/s. The convergence speed
|
298
308
|
# determines how the different sensor measurements are fused.
|
299
309
|
#
|
300
|
-
# If the orientation of the IMU Brick is off by 10° and the convergence speed is
|
310
|
+
# If the orientation of the IMU Brick is off by 10° and the convergence speed is
|
301
311
|
# set to 20°/s, it will take 0.5s until the orientation is corrected. However,
|
302
312
|
# if the correct orientation is reached and the convergence speed is too high,
|
303
313
|
# the orientation will fluctuate with the fluctuations of the accelerometer and
|
@@ -313,8 +323,8 @@ module Tinkerforge
|
|
313
323
|
# In an application with high angular velocities, we recommend a high convergence
|
314
324
|
# speed, so the errors of the gyroscope can be corrected fast. In applications with
|
315
325
|
# only slow movements we recommend a low convergence speed. You can change the
|
316
|
-
# convergence speed on the fly. So it is possible (and recommended) to increase
|
317
|
-
# the convergence speed before an abrupt movement and decrease it afterwards
|
326
|
+
# convergence speed on the fly. So it is possible (and recommended) to increase
|
327
|
+
# the convergence speed before an abrupt movement and decrease it afterwards
|
318
328
|
# again.
|
319
329
|
#
|
320
330
|
# You might want to play around with the convergence speed in the Brick Viewer to
|
@@ -384,8 +394,8 @@ module Tinkerforge
|
|
384
394
|
send_request(FUNCTION_GET_ACCELERATION_PERIOD, [], '', 4, 'L')
|
385
395
|
end
|
386
396
|
|
387
|
-
# Sets the period in ms with which the CALLBACK_MAGNETIC_FIELD callback is
|
388
|
-
# periodically. A value of 0 turns the callback off.
|
397
|
+
# Sets the period in ms with which the CALLBACK_MAGNETIC_FIELD callback is
|
398
|
+
# triggered periodically. A value of 0 turns the callback off.
|
389
399
|
def set_magnetic_field_period(period)
|
390
400
|
send_request(FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'L', 0, '')
|
391
401
|
end
|
@@ -395,8 +405,8 @@ module Tinkerforge
|
|
395
405
|
send_request(FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 4, 'L')
|
396
406
|
end
|
397
407
|
|
398
|
-
# Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
|
399
|
-
# periodically. A value of 0 turns the callback off.
|
408
|
+
# Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
|
409
|
+
# triggered periodically. A value of 0 turns the callback off.
|
400
410
|
def set_angular_velocity_period(period)
|
401
411
|
send_request(FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 0, '')
|
402
412
|
end
|
@@ -453,7 +463,7 @@ module Tinkerforge
|
|
453
463
|
# If the calculation is off, BrickIMU#get_orientation will return
|
454
464
|
# the last calculated value until the calculation is turned on again.
|
455
465
|
#
|
456
|
-
# The trigonometric functions that are needed to calculate the orientation
|
466
|
+
# The trigonometric functions that are needed to calculate the orientation
|
457
467
|
# are very expensive. We recommend to turn the orientation calculation
|
458
468
|
# off if the orientation is not needed, to free calculation time for the
|
459
469
|
# sensor fusion algorithm.
|
@@ -473,6 +483,18 @@ module Tinkerforge
|
|
473
483
|
send_request(FUNCTION_IS_ORIENTATION_CALCULATION_ON, [], '', 1, '?')
|
474
484
|
end
|
475
485
|
|
486
|
+
# Returns the timeout count for the different communication methods.
|
487
|
+
#
|
488
|
+
# The methods 0-2 are available for all Bricks, 3-7 only for Master Bricks.
|
489
|
+
#
|
490
|
+
# This function is mostly used for debugging during development, in normal operation
|
491
|
+
# the counters should nearly always stay at 0.
|
492
|
+
#
|
493
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
494
|
+
def get_send_timeout_count(communication_method)
|
495
|
+
send_request(FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L')
|
496
|
+
end
|
497
|
+
|
476
498
|
# Enables the status LED.
|
477
499
|
#
|
478
500
|
# The status LED is the blue LED next to the USB connector. If enabled is is
|
@@ -533,7 +555,7 @@ module Tinkerforge
|
|
533
555
|
send_request(FUNCTION_RESET, [], '', 0, '')
|
534
556
|
end
|
535
557
|
|
536
|
-
# Returns the UID, the UID where the Brick is connected to,
|
558
|
+
# Returns the UID, the UID where the Brick is connected to,
|
537
559
|
# the position, the hardware and firmware version as well as the
|
538
560
|
# device identifier.
|
539
561
|
#
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
@@ -21,13 +21,13 @@ module Tinkerforge
|
|
21
21
|
CALLBACK_ACCELERATION = 32
|
22
22
|
|
23
23
|
# This callback is triggered periodically with the period that is set by
|
24
|
-
# BrickIMUV2#set_magnetic_field_period. The parameters are the magnetic
|
25
|
-
# for the x, y and z axis.
|
24
|
+
# BrickIMUV2#set_magnetic_field_period. The parameters are the magnetic
|
25
|
+
# field for the x, y and z axis.
|
26
26
|
CALLBACK_MAGNETIC_FIELD = 33
|
27
27
|
|
28
28
|
# This callback is triggered periodically with the period that is set by
|
29
|
-
# BrickIMUV2#set_angular_velocity_period. The parameters are the angular
|
30
|
-
# for the x, y and z axis.
|
29
|
+
# BrickIMUV2#set_angular_velocity_period. The parameters are the angular
|
30
|
+
# velocity for the x, y and z axis.
|
31
31
|
CALLBACK_ANGULAR_VELOCITY = 34
|
32
32
|
|
33
33
|
# This callback is triggered periodically with the period that is set by
|
@@ -35,7 +35,7 @@ module Tinkerforge
|
|
35
35
|
CALLBACK_TEMPERATURE = 35
|
36
36
|
|
37
37
|
# This callback is triggered periodically with the period that is set by
|
38
|
-
# BrickIMUV2#set_linear_acceleration_period. The parameters are the
|
38
|
+
# BrickIMUV2#set_linear_acceleration_period. The parameters are the
|
39
39
|
# linear acceleration for the x, y and z axis.
|
40
40
|
CALLBACK_LINEAR_ACCELERATION = 36
|
41
41
|
|
@@ -57,7 +57,8 @@ module Tinkerforge
|
|
57
57
|
CALLBACK_QUATERNION = 39
|
58
58
|
|
59
59
|
# This callback is triggered periodically with the period that is set by
|
60
|
-
# BrickIMUV2#set_all_data_period. The parameters are as for
|
60
|
+
# BrickIMUV2#set_all_data_period. The parameters are as for
|
61
|
+
# BrickIMUV2#get_all_data.
|
61
62
|
CALLBACK_ALL_DATA = 40
|
62
63
|
|
63
64
|
FUNCTION_GET_ACCELERATION = 1 # :nodoc:
|
@@ -95,6 +96,7 @@ module Tinkerforge
|
|
95
96
|
FUNCTION_GET_SENSOR_CONFIGURATION = 42 # :nodoc:
|
96
97
|
FUNCTION_SET_SENSOR_FUSION_MODE = 43 # :nodoc:
|
97
98
|
FUNCTION_GET_SENSOR_FUSION_MODE = 44 # :nodoc:
|
99
|
+
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
98
100
|
FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
|
99
101
|
FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
|
100
102
|
FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
|
@@ -138,6 +140,15 @@ module Tinkerforge
|
|
138
140
|
ACCELEROMETER_BANDWIDTH_1000HZ = 7 # :nodoc:
|
139
141
|
SENSOR_FUSION_OFF = 0 # :nodoc:
|
140
142
|
SENSOR_FUSION_ON = 1 # :nodoc:
|
143
|
+
SENSOR_FUSION_ON_WITHOUT_MAGNETOMETER = 2 # :nodoc:
|
144
|
+
COMMUNICATION_METHOD_NONE = 0 # :nodoc:
|
145
|
+
COMMUNICATION_METHOD_USB = 1 # :nodoc:
|
146
|
+
COMMUNICATION_METHOD_SPI_STACK = 2 # :nodoc:
|
147
|
+
COMMUNICATION_METHOD_CHIBI = 3 # :nodoc:
|
148
|
+
COMMUNICATION_METHOD_RS485 = 4 # :nodoc:
|
149
|
+
COMMUNICATION_METHOD_WIFI = 5 # :nodoc:
|
150
|
+
COMMUNICATION_METHOD_ETHERNET = 6 # :nodoc:
|
151
|
+
COMMUNICATION_METHOD_WIFI_V2 = 7 # :nodoc:
|
141
152
|
|
142
153
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
143
154
|
# the IP Connection <tt>ipcon</tt>.
|
@@ -190,6 +201,7 @@ module Tinkerforge
|
|
190
201
|
@response_expected[FUNCTION_GET_SENSOR_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
191
202
|
@response_expected[FUNCTION_SET_SENSOR_FUSION_MODE] = RESPONSE_EXPECTED_FALSE
|
192
203
|
@response_expected[FUNCTION_GET_SENSOR_FUSION_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
204
|
+
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
193
205
|
@response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
194
206
|
@response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
195
207
|
@response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -209,37 +221,37 @@ module Tinkerforge
|
|
209
221
|
@callback_formats[CALLBACK_ALL_DATA] = 's3 s3 s3 s3 s4 s3 s3 c C'
|
210
222
|
end
|
211
223
|
|
212
|
-
# Returns the calibrated acceleration from the accelerometer for the
|
224
|
+
# Returns the calibrated acceleration from the accelerometer for the
|
213
225
|
# x, y and z axis in 1/100 m/s².
|
214
226
|
#
|
215
|
-
# If you want to get the acceleration periodically, it is recommended
|
216
|
-
# to use the callback
|
227
|
+
# If you want to get the acceleration periodically, it is recommended
|
228
|
+
# to use the CALLBACK_ACCELERATION callback and set the period with
|
217
229
|
# BrickIMUV2#set_acceleration_period.
|
218
230
|
def get_acceleration
|
219
231
|
send_request(FUNCTION_GET_ACCELERATION, [], '', 6, 's s s')
|
220
232
|
end
|
221
233
|
|
222
|
-
# Returns the calibrated magnetic field from the magnetometer for the
|
234
|
+
# Returns the calibrated magnetic field from the magnetometer for the
|
223
235
|
# x, y and z axis in 1/16 µT (Microtesla).
|
224
236
|
#
|
225
|
-
# If you want to get the magnetic field periodically, it is recommended
|
226
|
-
# to use the callback
|
237
|
+
# If you want to get the magnetic field periodically, it is recommended
|
238
|
+
# to use the CALLBACK_MAGNETIC_FIELD callback and set the period with
|
227
239
|
# BrickIMUV2#set_magnetic_field_period.
|
228
240
|
def get_magnetic_field
|
229
241
|
send_request(FUNCTION_GET_MAGNETIC_FIELD, [], '', 6, 's s s')
|
230
242
|
end
|
231
243
|
|
232
|
-
# Returns the calibrated angular velocity from the gyroscope for the
|
244
|
+
# Returns the calibrated angular velocity from the gyroscope for the
|
233
245
|
# x, y and z axis in 1/16 °/s.
|
234
246
|
#
|
235
|
-
# If you want to get the angular velocity periodically, it is recommended
|
236
|
-
# to use the
|
247
|
+
# If you want to get the angular velocity periodically, it is recommended
|
248
|
+
# to use the CALLBACK_ANGULAR_VELOCITY acallback nd set the period with
|
237
249
|
# BrickIMUV2#set_angular_velocity_period.
|
238
250
|
def get_angular_velocity
|
239
251
|
send_request(FUNCTION_GET_ANGULAR_VELOCITY, [], '', 6, 's s s')
|
240
252
|
end
|
241
253
|
|
242
|
-
# Returns the temperature of the IMU Brick. The temperature is given in
|
254
|
+
# Returns the temperature of the IMU Brick. The temperature is given in
|
243
255
|
# °C. The temperature is measured in the core of the BNO055 IC, it is not the
|
244
256
|
# ambient temperature
|
245
257
|
def get_temperature
|
@@ -248,8 +260,9 @@ module Tinkerforge
|
|
248
260
|
|
249
261
|
# Returns the current orientation (heading, roll, pitch) of the IMU Brick as
|
250
262
|
# independent Euler angles in 1/16 degree. Note that Euler angles always
|
251
|
-
# experience a `gimbal lock <https://en.wikipedia.org/wiki/Gimbal_lock>`__.
|
252
|
-
# recommend that you use quaternions instead, if you need the absolute
|
263
|
+
# experience a `gimbal lock <https://en.wikipedia.org/wiki/Gimbal_lock>`__.
|
264
|
+
# We recommend that you use quaternions instead, if you need the absolute
|
265
|
+
# orientation.
|
253
266
|
#
|
254
267
|
# The rotation angle has the following ranges:
|
255
268
|
#
|
@@ -257,8 +270,8 @@ module Tinkerforge
|
|
257
270
|
# * roll: -90° to +90°
|
258
271
|
# * pitch: -180° to +180°
|
259
272
|
#
|
260
|
-
# If you want to get the orientation periodically, it is recommended
|
261
|
-
# to use the callback
|
273
|
+
# If you want to get the orientation periodically, it is recommended
|
274
|
+
# to use the CALLBACK_ORIENTATION callback and set the period with
|
262
275
|
# BrickIMUV2#set_orientation_period.
|
263
276
|
def get_orientation
|
264
277
|
send_request(FUNCTION_GET_ORIENTATION, [], '', 6, 's s s')
|
@@ -273,8 +286,8 @@ module Tinkerforge
|
|
273
286
|
# It is also possible to get the gravity vector with the influence of linear
|
274
287
|
# acceleration removed, see BrickIMUV2#get_gravity_vector.
|
275
288
|
#
|
276
|
-
# If you want to get the linear acceleration periodically, it is recommended
|
277
|
-
# to use the callback
|
289
|
+
# If you want to get the linear acceleration periodically, it is recommended
|
290
|
+
# to use the CALLBACK_LINEAR_ACCELERATION callback and set the period with
|
278
291
|
# BrickIMUV2#set_linear_acceleration_period.
|
279
292
|
def get_linear_acceleration
|
280
293
|
send_request(FUNCTION_GET_LINEAR_ACCELERATION, [], '', 6, 's s s')
|
@@ -286,11 +299,11 @@ module Tinkerforge
|
|
286
299
|
# The gravity vector is the acceleration that occurs due to gravity.
|
287
300
|
# Influences of additional linear acceleration are removed.
|
288
301
|
#
|
289
|
-
# It is also possible to get the linear acceleration with the influence
|
302
|
+
# It is also possible to get the linear acceleration with the influence
|
290
303
|
# of gravity removed, see BrickIMUV2#get_linear_acceleration.
|
291
304
|
#
|
292
|
-
# If you want to get the gravity vector periodically, it is recommended
|
293
|
-
# to use the callback
|
305
|
+
# If you want to get the gravity vector periodically, it is recommended
|
306
|
+
# to use the CALLBACK_GRAVITY_VECTOR callback and set the period with
|
294
307
|
# BrickIMUV2#set_gravity_vector_period.
|
295
308
|
def get_gravity_vector
|
296
309
|
send_request(FUNCTION_GET_GRAVITY_VECTOR, [], '', 6, 's s s')
|
@@ -302,8 +315,8 @@ module Tinkerforge
|
|
302
315
|
# You have to divide the returns values by 16383 (14 bit) to get
|
303
316
|
# the usual range of -1.0 to +1.0 for quaternions.
|
304
317
|
#
|
305
|
-
# If you want to get the quaternions periodically, it is recommended
|
306
|
-
# to use the callback
|
318
|
+
# If you want to get the quaternions periodically, it is recommended
|
319
|
+
# to use the CALLBACK_QUATERNION callback and set the period with
|
307
320
|
# BrickIMUV2#set_quaternion_period.
|
308
321
|
def get_quaternion
|
309
322
|
send_request(FUNCTION_GET_QUATERNION, [], '', 8, 's s s s')
|
@@ -336,8 +349,8 @@ module Tinkerforge
|
|
336
349
|
# calibration. See the documentation in the calibration window for
|
337
350
|
# more information regarding the calibration of the IMU Brick.
|
338
351
|
#
|
339
|
-
# If you want to get the data periodically, it is recommended
|
340
|
-
# to use the callback
|
352
|
+
# If you want to get the data periodically, it is recommended
|
353
|
+
# to use the CALLBACK_ALL_DATA callback and set the period with
|
341
354
|
# BrickIMUV2#set_all_data_period.
|
342
355
|
def get_all_data
|
343
356
|
send_request(FUNCTION_GET_ALL_DATA, [], '', 46, 's3 s3 s3 s3 s4 s3 s3 c C')
|
@@ -364,7 +377,7 @@ module Tinkerforge
|
|
364
377
|
# of the IMU Brick.
|
365
378
|
#
|
366
379
|
# A return value of *true* means that the calibration could be used and
|
367
|
-
# *false* means that it could not be used (this happens if the calibration
|
380
|
+
# *false* means that it could not be used (this happens if the calibration
|
368
381
|
# status is not "fully calibrated").
|
369
382
|
#
|
370
383
|
# This function is used by the calibration window of the Brick Viewer, you
|
@@ -397,8 +410,8 @@ module Tinkerforge
|
|
397
410
|
send_request(FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 4, 'L')
|
398
411
|
end
|
399
412
|
|
400
|
-
# Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
|
401
|
-
# periodically. A value of 0 turns the callback off.
|
413
|
+
# Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
|
414
|
+
# triggered periodically. A value of 0 turns the callback off.
|
402
415
|
def set_angular_velocity_period(period)
|
403
416
|
send_request(FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 0, '')
|
404
417
|
end
|
@@ -430,8 +443,8 @@ module Tinkerforge
|
|
430
443
|
send_request(FUNCTION_GET_ORIENTATION_PERIOD, [], '', 4, 'L')
|
431
444
|
end
|
432
445
|
|
433
|
-
# Sets the period in ms with which the CALLBACK_LINEAR_ACCELERATION callback is
|
434
|
-
# periodically. A value of 0 turns the callback off.
|
446
|
+
# Sets the period in ms with which the CALLBACK_LINEAR_ACCELERATION callback is
|
447
|
+
# triggered periodically. A value of 0 turns the callback off.
|
435
448
|
def set_linear_acceleration_period(period)
|
436
449
|
send_request(FUNCTION_SET_LINEAR_ACCELERATION_PERIOD, [period], 'L', 0, '')
|
437
450
|
end
|
@@ -486,7 +499,6 @@ module Tinkerforge
|
|
486
499
|
# * Accelerometer Range +/-4G
|
487
500
|
# * Accelerometer Bandwidth 62.5Hz
|
488
501
|
#
|
489
|
-
#
|
490
502
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
491
503
|
def set_sensor_configuration(magnetometer_rate, gyroscope_range, gyroscope_bandwidth, accelerometer_range, accelerometer_bandwidth)
|
492
504
|
send_request(FUNCTION_SET_SENSOR_CONFIGURATION, [magnetometer_rate, gyroscope_range, gyroscope_bandwidth, accelerometer_range, accelerometer_bandwidth], 'C C C C C', 0, '')
|
@@ -499,10 +511,14 @@ module Tinkerforge
|
|
499
511
|
send_request(FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 5, 'C C C C C')
|
500
512
|
end
|
501
513
|
|
502
|
-
# If the fusion mode is turned off, the functions
|
503
|
-
# BrickIMUV2#
|
504
|
-
#
|
505
|
-
#
|
514
|
+
# If the fusion mode is turned off, the functions BrickIMUV2#get_acceleration,
|
515
|
+
# BrickIMUV2#get_magnetic_field and BrickIMUV2#get_angular_velocity return uncalibrated
|
516
|
+
# and uncompensated sensor data. All other sensor data getters return no data.
|
517
|
+
#
|
518
|
+
# Since firmware version 2.0.6 you can also use a fusion mode without magnetometer.
|
519
|
+
# In this mode the calculated orientation is relative (with magnetometer it is
|
520
|
+
# absolute with respect to the earth). However, the calculation can't be influenced
|
521
|
+
# by spurious magnetic fields.
|
506
522
|
#
|
507
523
|
# By default sensor fusion is on.
|
508
524
|
#
|
@@ -518,6 +534,18 @@ module Tinkerforge
|
|
518
534
|
send_request(FUNCTION_GET_SENSOR_FUSION_MODE, [], '', 1, 'C')
|
519
535
|
end
|
520
536
|
|
537
|
+
# Returns the timeout count for the different communication methods.
|
538
|
+
#
|
539
|
+
# The methods 0-2 are available for all Bricks, 3-7 only for Master Bricks.
|
540
|
+
#
|
541
|
+
# This function is mostly used for debugging during development, in normal operation
|
542
|
+
# the counters should nearly always stay at 0.
|
543
|
+
#
|
544
|
+
# .. versionadded:: 2.0.7$nbsp;(Firmware)
|
545
|
+
def get_send_timeout_count(communication_method)
|
546
|
+
send_request(FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L')
|
547
|
+
end
|
548
|
+
|
521
549
|
# Enables the status LED.
|
522
550
|
#
|
523
551
|
# The status LED is the blue LED next to the USB connector. If enabled is is
|
@@ -572,7 +600,7 @@ module Tinkerforge
|
|
572
600
|
send_request(FUNCTION_RESET, [], '', 0, '')
|
573
601
|
end
|
574
602
|
|
575
|
-
# Returns the UID, the UID where the Brick is connected to,
|
603
|
+
# Returns the UID, the UID where the Brick is connected to,
|
576
604
|
# the position, the hardware and firmware version as well as the
|
577
605
|
# device identifier.
|
578
606
|
#
|