Skip to content

Commit 15fa1f5

Browse files
committed
feat(OpenGloves): add FFB configs
1 parent 7d3166b commit 15fa1f5

File tree

4 files changed

+201
-11
lines changed

4 files changed

+201
-11
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,31 +165,31 @@ jobs:
165165
target:
166166
- lucidgloves-prototype3
167167
- lucidgloves-prototype4
168+
- indexer-c
169+
- indexer-cf
170+
- indexer-cs
171+
- indexer-csf
168172
comm_flag:
169-
- COMMUNICATION_PROTOCOL=COMMUNICATION_PROTOCOL_SERIAL
170-
- COMMUNICATION_PROTOCOL=COMMUNICATION_PROTOCOL_BLE
173+
- COMMUNICATION_PROTOCOL=OPENGLOVES_COMM_SERIAL
174+
- COMMUNICATION_PROTOCOL=OPENGLOVES_COMM_BTSERIAL
171175
coverage: [ false ]
172176

173177
include:
174178
- os: ubuntu-latest
175-
target: lucidgloves-prototype4
179+
target: lucidgloves-prototype4-ffb
176180
curl_calibration_flag: CALIBRATION_CURL="OH::MinMaxCalibrator<uint16_t, 0, ANALOG_MAX>"
177181
coverage: true
178182
- os: ubuntu-latest
179-
target: lucidgloves-prototype4
183+
target: lucidgloves-prototype4-ffb
180184
curl_calibration_flag: CALIBRATION_CURL="OH::CenterPointDeviationCalibrator<uint16_t, 20, 270, 0, ANALOG_MAX>"
181185
coverage: true
182186
- os: ubuntu-latest
183-
target: lucidgloves-prototype4
187+
target: lucidgloves-prototype4-ffb
184188
curl_calibration_flag: CALIBRATION_CURL="OH::FixedCenterPointDeviationCalibrator<uint16_t, 20, 270, 0, ANALOG_MAX>"
185189
coverage: true
186190
- os: ubuntu-latest
187-
target: indexer-c
188-
comm_flag: COMMUNICATION_PROTOCOL=COMMUNICATION_PROTOCOL_SERIAL
189-
coverage: true
190-
- os: ubuntu-latest
191-
target: indexer-cs
192-
comm_flag: COMMUNICATION_PROTOCOL=COMMUNICATION_PROTOCOL_SERIAL
191+
target: indexer-csf
192+
comm_flag: COMMUNICATION_PROTOCOL=OPENGLOVES_COMM_BTSERIAL
193193
coverage: true
194194

195195
steps:

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ jobs:
124124
target:
125125
- lucidgloves-prototype3
126126
- lucidgloves-prototype4
127+
- lucidgloves-prototype4-ffb
127128
- indexer-c
129+
- indexer-cf
128130
- indexer-cs
131+
- indexer-csf
129132
comm_flag:
130133
- OPENGLOVES_COMMUNCATION=OPENGLOVES_COMM_SERIAL
131134
- OPENGLOVES_COMMUNCATION=OPENGLOVES_COMM_BTSERIAL

firmware/mode_configs/opengloves/opengloves.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <og_constants.hpp>
33
#include <og_serial_communication.hpp>
44
#include <opengloves_task.hpp>
5+
#include <output_writers/pwm.hpp>
56
#include <sensor.hpp>
67
#include <sensor/analog.hpp>
78
#include <sensor/digital.hpp>
@@ -122,6 +123,14 @@
122123
#define UPDATE_RATE 90
123124
#endif
124125

126+
#define FFB_THUMB_ENABLED (defined(PIN_FFB_THUMB) && (PIN_FFB_THUMB != -1))
127+
#define FFB_INDEX_ENABLED (defined(PIN_FFB_INDEX) && (PIN_FFB_INDEX != -1))
128+
#define FFB_MIDDLE_ENABLED (defined(PIN_FFB_MIDDLE) && (PIN_FFB_MIDDLE != -1))
129+
#define FFB_RING_ENABLED (defined(PIN_FFB_RING) && (PIN_FFB_RING != -1))
130+
#define FFB_PINKY_ENABLED (defined(PIN_FFB_PINKY) && (PIN_FFB_PINKY != -1))
131+
132+
#define FFB_ENABLED (FFB_THUMB_ENABLED || FFB_INDEX_ENABLED || FFB_MIDDLE_ENABLED || FFB_RING_ENABLED || FFB_PINKY_ENABLED)
133+
125134
using namespace OpenGloves;
126135

127136
HandSensors handSensors = {
@@ -271,6 +280,31 @@ std::vector<IStringEncodedMemoizedSensor*> otherSensors = std::vector<IStringEnc
271280
OpenGlovesTrackingTaskConfig config = OpenGlovesTrackingTaskConfig(UPDATE_RATE, CALIBRATION_DURATION, CALIBRATION_ALWAYS_CALIBRATE);
272281
OpenGlovesTrackingTask* trackingTask;
273282

283+
#if FFB_ENABLED
284+
HandActuators handActuators = {
285+
#if FFB_THUMB_ENABLED
286+
.thumb = new OH::PWMOutputWriter(PIN_FFB_THUMB),
287+
#endif
288+
289+
#if FFB_INDEX_ENABLED
290+
.index = new OH::PWMOutputWriter(PIN_FFB_INDEX),
291+
#endif
292+
293+
#if FFB_MIDDLE_ENABLED
294+
.middle = new OH::PWMOutputWriter(PIN_FFB_MIDDLE),
295+
#endif
296+
297+
#if FFB_RING_ENABLED
298+
.ring = new OH::PWMOutputWriter(PIN_FFB_RING),
299+
#endif
300+
301+
#if FFB_PINKY_ENABLED
302+
.pinky = new OH::PWMOutputWriter(PIN_FFB_PINKY),
303+
#endif
304+
};
305+
OpenGlovesForceFeedbackTask* ffbTask;
306+
#endif
307+
274308
void setupMode()
275309
{
276310
#if OPENGLOVES_COMMUNCATION == OPENGLOVES_COMM_SERIAL
@@ -302,6 +336,21 @@ void setupMode()
302336
.priority = OPENGLOVES_FINGERS_TASK_PRIORITY,
303337
}
304338
);
339+
340+
#if FFB_ENABLED
341+
ffbTask = new OpenGlovesForceFeedbackTask(
342+
*communication,
343+
handActuators,
344+
60,
345+
{
346+
.name = "OpenGlovesForceFeedbackTask",
347+
.stackDepth = 8192,
348+
.priority = OPENGLOVES_FINGERS_TASK_PRIORITY,
349+
}
350+
);
351+
ffbTask->begin();
352+
#endif
353+
305354
trackingTask->begin();
306355
}
307356

ini/opengloves.ini

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,50 @@ build_src_filter = ${opengloves.build_src_filter}
132132
+<mode_configs/opengloves/opengloves.cpp>
133133
lib_deps = ${opengloves.lib_deps}
134134

135+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
136+
; LucidGloves Prototype 4 + Force Feedback
137+
; Wiring Diagram: https://github.com/LucidVR/lucidgloves/wiki/Prototype-4-Wiring-Diagram
138+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
139+
[env:lucidgloves-prototype4-ffb]
140+
platform = ${opengloves.platform}
141+
platform_packages = ${opengloves.platform_packages}
142+
framework = ${opengloves.framework}
143+
board = ${opengloves.board}
144+
upload_speed = ${opengloves.upload_speed}
145+
monitor_speed = ${opengloves.monitor_speed}
146+
147+
build_flags = ${opengloves.build_flags}
148+
; Pins configuration
149+
; Comment out to disable
150+
-D PIN_FINGER_THUMB=32
151+
-D PIN_FINGER_INDEX=35
152+
-D PIN_FINGER_MIDDLE=34
153+
-D PIN_FINGER_RING=39
154+
-D PIN_FINGER_PINKY=36
155+
156+
-D PIN_JOYSTICK_X=33
157+
-D PIN_JOYSTICK_Y=25
158+
-D PIN_BUTTON_JOYSTICK=26
159+
160+
-D PIN_BUTTON_A=27
161+
-D PIN_BUTTON_B=14
162+
; -D PIN_BUTTON_MENU=27
163+
-D PIN_BUTTON_CALIBRATE=12
164+
; -D PIN_BUTTON_TRIGGER=12 ; unused if GESTURE_TRIGGER is true
165+
; -D PIN_BUTTON_GRAB=13 ; unused if GESTURE_GRAB is true
166+
; -D PIN_BUTTON_PINCH=23 ; unused if GESTURE_PINCH is true
167+
168+
-D PIN_FFB_THUMB=17
169+
-D PIN_FFB_INDEX=21
170+
-D PIN_FFB_MIDDLE=19
171+
-D PIN_FFB_RING=18
172+
-D PIN_FFB_PINKY=5
173+
174+
build_unflags = ${opengloves.build_unflags}
175+
build_src_filter = ${opengloves.build_src_filter}
176+
+<mode_configs/opengloves/opengloves.cpp>
177+
lib_deps = ${opengloves.lib_deps}
178+
135179
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
136180
; Indexer C
137181
; Wiring Diagram: https://github.com/Valsvirtuals/Indexer/wiki/wiring-and-pinout
@@ -170,6 +214,50 @@ build_src_filter = ${opengloves.build_src_filter}
170214
+<mode_configs/opengloves/opengloves.cpp>
171215
lib_deps = ${opengloves.lib_deps}
172216

217+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
218+
; Indexer CF
219+
; Wiring Diagram: https://github.com/Valsvirtuals/Indexer/wiki/wiring-and-pinout
220+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
221+
[env:indexer-cf]
222+
platform = ${opengloves.platform}
223+
platform_packages = ${opengloves.platform_packages}
224+
framework = ${opengloves.framework}
225+
board = wemos_d1_mini32
226+
upload_speed = ${opengloves.upload_speed}
227+
monitor_speed = ${opengloves.monitor_speed}
228+
229+
build_flags = ${opengloves.build_flags}
230+
; Pins configuration
231+
; Comment out to disable
232+
-D PIN_FINGER_THUMB=25
233+
-D PIN_FINGER_INDEX=14
234+
-D PIN_FINGER_MIDDLE=33
235+
-D PIN_FINGER_RING=39
236+
-D PIN_FINGER_PINKY=36
237+
238+
-D PIN_JOYSTICK_X=12
239+
-D PIN_JOYSTICK_Y=4
240+
-D PIN_BUTTON_JOYSTICK=0
241+
242+
-D PIN_BUTTON_A=2
243+
-D PIN_BUTTON_B=11
244+
; -D PIN_BUTTON_MENU=5
245+
-D PIN_BUTTON_CALIBRATE=27
246+
; -D PIN_BUTTON_TRIGGER=19 ; unused if GESTURE_TRIGGER is true
247+
; -D PIN_BUTTON_GRAB=18 ; unused if GESTURE_GRAB is true
248+
; -D PIN_BUTTON_PINCH=23 ; unused if GESTURE_PINCH is true
249+
250+
-D PIN_FFB_THUMB=16
251+
-D PIN_FFB_INDEX=17
252+
-D PIN_FFB_MIDDLE=21
253+
-D PIN_FFB_RING=22
254+
-D PIN_FFB_PINKY=1
255+
256+
build_unflags = ${opengloves.build_unflags}
257+
build_src_filter = ${opengloves.build_src_filter}
258+
+<mode_configs/opengloves/opengloves.cpp>
259+
lib_deps = ${opengloves.lib_deps}
260+
173261
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
174262
; Indexer CS
175263
; Wiring Diagram: https://github.com/Valsvirtuals/Indexer/wiki/wiring-and-pinout
@@ -213,3 +301,53 @@ build_unflags = ${opengloves.build_unflags}
213301
build_src_filter = ${opengloves.build_src_filter}
214302
+<mode_configs/opengloves/opengloves.cpp>
215303
lib_deps = ${opengloves.lib_deps}
304+
305+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
306+
; Indexer CSF
307+
; Wiring Diagram: https://github.com/Valsvirtuals/Indexer/wiki/wiring-and-pinout
308+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
309+
[env:indexer-csf]
310+
platform = ${opengloves.platform}
311+
platform_packages = ${opengloves.platform_packages}
312+
framework = ${opengloves.framework}
313+
board = wemos_d1_mini32
314+
upload_speed = ${opengloves.upload_speed}
315+
monitor_speed = ${opengloves.monitor_speed}
316+
317+
build_flags = ${opengloves.build_flags}
318+
; Pins configuration
319+
; Comment out to disable
320+
-D PIN_FINGER_THUMB=25
321+
-D PIN_FINGER_INDEX=14
322+
-D PIN_FINGER_MIDDLE=33
323+
-D PIN_FINGER_RING=39
324+
-D PIN_FINGER_PINKY=36
325+
326+
-D PIN_FINGER_THUMB_SPLAY=32
327+
-D PIN_FINGER_INDEX_SPLAY=13
328+
-D PIN_FINGER_MIDDLE_SPLAY=34
329+
-D PIN_FINGER_RING_SPLAY=35
330+
-D PIN_FINGER_PINKY_SPLAY=26
331+
332+
-D PIN_JOYSTICK_X=12
333+
-D PIN_JOYSTICK_Y=4
334+
-D PIN_BUTTON_JOYSTICK=0
335+
336+
-D PIN_BUTTON_A=2
337+
-D PIN_BUTTON_B=11
338+
; -D PIN_BUTTON_MENU=5
339+
-D PIN_BUTTON_CALIBRATE=27
340+
; -D PIN_BUTTON_TRIGGER=19 ; unused if GESTURE_TRIGGER is true
341+
; -D PIN_BUTTON_GRAB=18 ; unused if GESTURE_GRAB is true
342+
; -D PIN_BUTTON_PINCH=23 ; unused if GESTURE_PINCH is true
343+
344+
-D PIN_FFB_THUMB=16
345+
-D PIN_FFB_INDEX=17
346+
-D PIN_FFB_MIDDLE=21
347+
-D PIN_FFB_RING=22
348+
-D PIN_FFB_PINKY=1
349+
350+
build_unflags = ${opengloves.build_unflags}
351+
build_src_filter = ${opengloves.build_src_filter}
352+
+<mode_configs/opengloves/opengloves.cpp>
353+
lib_deps = ${opengloves.lib_deps}

0 commit comments

Comments
 (0)