Skip to content

Commit 4891ade

Browse files
authored
Merge pull request #94 from botamochi6277/gaze
Redefine Avatar::getGaze for for backward compatibility & Update setting for development
2 parents a32a41f + b24f417 commit 4891ade

5 files changed

Lines changed: 168 additions & 20 deletions

File tree

.gitignore

Lines changed: 106 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,113 @@
1-
.pio/
2-
.pioenvs
3-
.piolibdeps
4-
.vscode/
5-
.vscode/.browse.c_cpp.db*
6-
.vscode/c_cpp_properties.json
7-
.vscode/launch.json
8-
.vscode/settings.json
1+
### Manual ###
92
lib/aqtkpico_esp32
103
lib/aquestalk_esp32
114
lib/aquestalk-esp32
125
src/*.ino
136
const.h
147
/tmp/
158

16-
# for macOS
17-
.DS_Store
9+
### gitignore.io
10+
# Created by https://www.toptal.com/developers/gitignore/api/platformio,visualstudiocode,windows,macos,linux
11+
# Edit at https://www.toptal.com/developers/gitignore?templates=platformio,visualstudiocode,windows,macos,linux
12+
13+
### Linux ###
14+
*~
15+
16+
# temporary files which can be created if a process still has a handle open of a deleted file
17+
.fuse_hidden*
18+
19+
# KDE directory preferences
20+
.directory
21+
22+
# Linux trash folder which might appear on any partition or disk
23+
.Trash-*
24+
25+
# .nfs files are created when an open file is removed but is still being accessed
26+
.nfs*
27+
28+
### macOS ###
29+
# General
30+
.DS_Store
31+
.AppleDouble
32+
.LSOverride
33+
34+
# Icon must end with two \r
35+
Icon
36+
37+
38+
# Thumbnails
39+
._*
40+
41+
# Files that might appear in the root of a volume
42+
.DocumentRevisions-V100
43+
.fseventsd
44+
.Spotlight-V100
45+
.TemporaryItems
46+
.Trashes
47+
.VolumeIcon.icns
48+
.com.apple.timemachine.donotpresent
49+
50+
# Directories potentially created on remote AFP share
51+
.AppleDB
52+
.AppleDesktop
53+
Network Trash Folder
54+
Temporary Items
55+
.apdisk
56+
57+
### macOS Patch ###
58+
# iCloud generated files
59+
*.icloud
60+
61+
### PlatformIO ###
62+
.pioenvs
63+
.piolibdeps
64+
.clang_complete
65+
.gcc-flags.json
66+
.pio
67+
68+
### VisualStudioCode ###
69+
.vscode/*
70+
!.vscode/settings.json
71+
!.vscode/tasks.json
72+
# !.vscode/launch.json
73+
!.vscode/extensions.json
74+
!.vscode/*.code-snippets
75+
76+
# Local History for Visual Studio Code
77+
.history/
78+
79+
# Built Visual Studio Code Extensions
80+
*.vsix
81+
82+
### VisualStudioCode Patch ###
83+
# Ignore all local history of files
84+
.history
85+
.ionide
86+
87+
### Windows ###
88+
# Windows thumbnail cache files
89+
Thumbs.db
90+
Thumbs.db:encryptable
91+
ehthumbs.db
92+
ehthumbs_vista.db
93+
94+
# Dump file
95+
*.stackdump
96+
97+
# Folder config file
98+
[Dd]esktop.ini
99+
100+
# Recycle Bin used on file shares
101+
$RECYCLE.BIN/
102+
103+
# Windows Installer files
104+
*.cab
105+
*.msi
106+
*.msix
107+
*.msm
108+
*.msp
109+
110+
# Windows shortcuts
111+
*.lnk
112+
113+
# End of https://www.toptal.com/developers/gitignore/api/platformio,visualstudiocode,windows,macos,linux

.vscode/settings.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
2-
"terminal.integrated.env.linux": {
3-
"PATH": "/home/sisikawa/.platformio/penv/bin:/home/sisikawa/.platformio/penv:/home/sisikawa/.cargo/bin:/home/sisikawa/go/bin:/bin:/home/sisikawa/.anyenv/envs/ndenv/shims:/home/sisikawa/.anyenv/envs/ndenv/bin:/home/sisikawa/.anyenv/envs/goenv/shims:/home/sisikawa/.anyenv/envs/goenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/sisikawa/.anyenv/bin",
4-
"PLATFORMIO_CALLER": "vscode"
5-
},
62
"files.associations": {
73
"limits": "cpp",
84
"array": "cpp",
@@ -43,5 +39,6 @@
4339
"typeinfo": "cpp",
4440
"utility": "cpp"
4541
},
42+
"C_Cpp.clang_format_style": "{ BasedOnStyle: Google, IndentWidth: 2 }",
4643
"cpplint.root": "src"
4744
}

platformio.ini

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,61 @@
1111
[platformio]
1212
default_envs = m5stack-core
1313

14-
[env]
15-
platform = espressif32
16-
framework = arduino
17-
monitor_speed = 115200
14+
; [env]
15+
; platform = espressif32
16+
; framework = arduino
17+
; monitor_speed = 115200
1818

1919
[env:m5stack-core]
2020
board = m5stack-core-esp32
21+
platform = espressif32
22+
framework = arduino
23+
monitor_speed = 115200
2124
lib_deps = m5stack/M5Unified
2225

2326
[env:m5stack-core-with-aquestalk]
2427
board = m5stack-core-esp32
28+
platform = espressif32
29+
framework = arduino
30+
monitor_speed = 115200
2531
lib_deps = m5stack/M5Unified
2632
build_flags =
2733
-laquestalk
2834
-Llib/aquestalk-esp32/src/esp32
2935

3036
[env:m5stack-fire]
3137
board = m5stack-fire
38+
platform = espressif32
39+
framework = arduino
40+
monitor_speed = 115200
3241
lib_deps =
3342
m5stack/M5Unified
3443

3544
[env:m5stack-core2]
3645
board = m5stack-core2
46+
platform = espressif32
47+
framework = arduino
48+
monitor_speed = 115200
3749
lib_deps =
3850
m5stack/M5Unified
51+
52+
[env:native]
53+
platform = native
54+
lib_deps = m5stack/M5Unified
55+
build_type = debug
56+
build_flags = -O0 -xc++ -std=c++14 -lSDL2
57+
-I"/usr/local/include/SDL2" ; for intel mac homebrew SDL2
58+
-L"/usr/local/lib" ; for intel mac homebrew SDL2
59+
-DM5GFX_SHOW_FRAME ; Display frame image.
60+
-DM5GFX_BACK_COLOR=0x222222u ; Color outside the frame image
61+
62+
[env:native_arm]
63+
platform = native
64+
build_type = debug
65+
lib_deps = m5stack/M5Unified
66+
build_flags = -O0 -xc++ -std=c++14 -lSDL2
67+
-arch arm64 ; for arm mac
68+
-I"${sysenv.HOMEBREW_PREFIX}/include/SDL2" ; for arm mac homebrew SDL2
69+
-L"${sysenv.HOMEBREW_PREFIX}/lib" ; for arm mac homebrew SDL2
70+
-DM5GFX_SHOW_FRAME ; Display frame image.
71+
-DM5GFX_BACK_COLOR=0x222222u ; Color outside the frame image

src/Avatar.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ void Avatar::getLeftGaze(float *vertical, float *horizontal) {
278278
*horizontal = this->leftGazeH_;
279279
}
280280

281+
void Avatar::getGaze(float *vertical, float *horizontal){
282+
*vertical = 0.5f * this->leftGazeV_ + 0.5f * this->rightGazeV_;
283+
*horizontal = 0.5f * this->leftGazeH_ + 0.5f * this->rightGazeH_;
284+
}
285+
281286
void Avatar::setSpeechText(const char *speechText) {
282287
this->speechText = String(speechText);
283288
}

src/Avatar.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,32 @@ class Avatar {
7070
void setColorPalette(ColorPalette cp);
7171
void setFace(Face *face);
7272
void init(int colorDepth = 1);
73+
// expression i/o
7374
Expression getExpression();
75+
void setExpression(Expression exp);
76+
// breath i/o
7477
void setBreath(float f);
7578
float getBreath();
79+
// gaze i/o
7680
void setRightGaze(float vertical, float horizontal);
7781
void getRightGaze(float *vertical, float *horizontal);
7882
void setLeftGaze(float vertical, float horizontal);
7983
void getLeftGaze(float *vertical, float *horizontal);
80-
void setExpression(Expression exp);
81-
// eyes functions
84+
85+
/**
86+
* @brief Get the Gaze of Avatar
87+
*
88+
* [warning] this function return the mean gaze of left gaze & right gaze
89+
* This is not the gaze representing avatar's direction of awareness
90+
*
91+
* @param vertical cache for vertical value. this value will be overwritten
92+
* by this method.
93+
* @param horizontal cache for horizontal value. this value will be
94+
* overwritten by this method.
95+
*/
96+
void getGaze(float *vertical, float *horizontal);
97+
98+
// eyes open ratio
8299
void setEyeOpenRatio(float ratio);
83100
void setRightEyeOpenRatio(float ratio);
84101
float getRightEyeOpenRatio();

0 commit comments

Comments
 (0)