menu LittleJake's Blog
color_lens
avatar
Jake Liu
Never Settle
creative commons by-nc-sa
hit
Category
keyboard_arrow_down

© 2024 LittleJake's Blog.

萌ICP备20223020号

体验身体追踪VR开源方案

前言

最近看见VRChat开始越来越有意思,除开垃圾的网络外,其实还是挺有趣的。而且,发现大家都开搞平民级别动捕套件。因此我也跟风弄个玩玩

SlimeVR

DIY手册

DIY trackers guide

组件清单

Components guide

由于采用多个冗余组件(防止手残) ,组件量会比官方偏多一些

组件类型 组件名称 数量 单价
控制板 D1 Mini 8 ¥10
传感器 BMI160 8 ¥7.5
电池 3.7V锂电池804040 8 ¥7
充电保护板 TP4056-TypeC-1A 8 ¥1.3
电源开关 SS12d00G4(需要裁剪开关高度) 20 ¥0.06
连接线 坏的苹果PD线 - -
外壳 The Hyperion(树脂3D打印) 8 ¥15
绑带 38*400mm 8 ¥1
电阻 180kΩ-1/4W 100 ¥0.018
二极管 1N5817 100 ¥0.05
总计 ¥342.4

材料一览

接线方法

Tracker schematics

我这里采用BMI160方案,增加二极管可以边充边用防止倒灌,增加电阻检测电池电压水平。

有兴趣查看各接口原理的可以点击上面官方文档链接

https://docs.slimevr.dev/diy/tracker-schematics.html

组装电阻二极管

放入外壳内

放入电池

焊接后

合上外壳

处理固件

Updating the tracker firmware

由于大陆内网络质量不佳,下载速度会极慢,需要耐心等待。

需要等待PlatformIO各种读条完毕才能进行固件编译

  1. 官方推荐使用Visual Studio Code,这边放上下载地址:Visual Studio Code,安装好后打开,安装插件PlatformIO IDE for VSCode

  2. 下载SlimeVR固件源码并解压:Download ZIP,使用Visual Studio Code打开项目文件夹

配置固件源码

platformio.ini

可选强制写入WIFI名称、密码,必须是2.4G WIFI,不支持5G

其他选项如不需要保持默认即可

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;

; ================================================
; See docs for configuration options and examples:
; https://docs.slimevr.dev/firmware/configuring-project.html#1-configuring-platformioini
; ================================================

[env]
lib_deps=
https://github.com/SlimeVR/CmdParser.git
monitor_speed = 115200
monitor_echo = yes
monitor_filters = colorize
;monitor_rts = 0
;monitor_dtr = 0
framework = arduino
build_flags =
;If you want to set hardcoded WiFi SSID and password, uncomment and edit the lines below
;To uncomment, only remove ";" and leave the two spaces in front of the tags
; '" - quotes are necessary!
-DWIFI_CREDS_SSID='"WIFI名称"'
-DWIFI_CREDS_PASSWD='"WIFI密码"'

; Enable -O2 GCC optimization
-O2

build_unflags = -Os

; If you want to enable OTA Updates, uncomment and set OTA password here and in credentials.h
; You can set upload_port to device's ip after it's set up for the first time
; Use the same password in SlimeVR Server to let it OTA Update the device
;upload_protocol = espota
;upload_port = 192.168.1.49
;upload_flags =
;  --auth=SlimeVR-OTA

; Settings for different boards

[env:esp12e]
platform = espressif8266
board = esp12e
; Comment out this line below if you have any trouble uploading the firmware
; and if it has a CP2102 on it (a square chip next to the usb port): change to 3000000 (3 million) for even faster upload speed
upload_speed = 921600

; Uncomment below if you want to build for ESP-01
;[env:esp01_1m]
;platform = espressif8266
;board = esp01_1m

; Uncomment below if you want to build for esp32
; Check your board name at https://docs.platformio.org/en/latest/platforms/espressif32.html#boards
; [env:esp32]
; platform = espressif32 @ 4.4.0
; board = esp32dev
; Comment out this line below if you have any trouble uploading the firmware - and if it has a CP2102 on it (a square chip next to the usb port): change to 3000000 (3 million) for even faster upload speed
; upload_speed = 921600

; If you want to use a esp32c3, you can use this (experimental)
;[env:esp32c3]
;platform = espressif32 @ 4.4.0
;board = lolin_c3_mini
src/defines.h

此处需要修改:IMU、BOARD,其他保持默认即可

/*
SlimeVR Code is placed under the MIT license
Copyright (c) 2021 Eiren Rain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// ================================================
// See docs for configuration options and examples:
// https://docs.slimevr.dev/firmware/configuring-project.html#2-configuring-definesh
// ================================================

// Set parameters of IMU and board used
#define IMU IMU_BMI160
#define SECOND_IMU IMU
#define BOARD BOARD_WEMOSD1MINI
#define IMU_ROTATION DEG_90
#define SECOND_IMU_ROTATION DEG_270

// Battery monitoring options (comment to disable):
//   BAT_EXTERNAL for ADC pin, 
//   BAT_INTERNAL for internal - can detect only low battery, 
//   BAT_MCP3021 for external ADC connected over I2C
#define BATTERY_MONITOR BAT_EXTERNAL

// BAT_EXTERNAL definition
// D1 Mini boards with ESP8266 have internal resistors. For these boards you only have to adjust BATTERY_SHIELD_RESISTANCE.
// For other boards you can now adjust the other resistor values.
// The diagram looks like this:
//   (Battery)--- [BATTERY_SHIELD_RESISTANCE] ---(INPUT_BOARD)---  [BATTERY_SHIELD_R2] ---(ESP32_INPUT)--- [BATTERY_SHIELD_R1] --- (GND)
#define BATTERY_SHIELD_RESISTANCE 180 //130k BatteryShield, 180k SlimeVR or fill in external resistor value in kOhm
// #define BATTERY_SHIELD_R1 100 // Board voltage divider resistor Ain to GND in kOhm
// #define BATTERY_SHIELD_R2 220 // Board voltage divider resistor Ain to INPUT_BOARD in kOhm

// LED configuration:
// Configuration Priority 1 = Highest:
// 1. LED_PIN
// 2. LED_BUILTIN
//
//   LED_PIN
//     - Number or Symbol (D1,..) of the Output
//     - To turn off the LED, set LED_PIN to LED_OFF
//   LED_INVERTED 
//     - false for output 3.3V on high
//     - true for pull down to GND on high

// Board-specific configurations
#if BOARD == BOARD_SLIMEVR
#define PIN_IMU_SDA 14
#define PIN_IMU_SCL 12
#define PIN_IMU_INT 16
#define PIN_IMU_INT_2 13
#define PIN_BATTERY_LEVEL 17
#define LED_PIN 2
#define LED_INVERTED true
#elif BOARD == BOARD_SLIMEVR_LEGACY || BOARD == BOARD_SLIMEVR_DEV
#define PIN_IMU_SDA 4
#define PIN_IMU_SCL 5
#define PIN_IMU_INT 10
#define PIN_IMU_INT_2 13
#define PIN_BATTERY_LEVEL 17
#define LED_PIN 2
#define LED_INVERTED true
#elif BOARD == BOARD_NODEMCU || BOARD == BOARD_WEMOSD1MINI
#define PIN_IMU_SDA D2
#define PIN_IMU_SCL D1
#define PIN_IMU_INT D5
#define PIN_IMU_INT_2 D6
#define PIN_BATTERY_LEVEL A0
//  #define LED_PIN 2
//  #define LED_INVERTED true
#elif BOARD == BOARD_ESP01
#define PIN_IMU_SDA 2
#define PIN_IMU_SCL 0
#define PIN_IMU_INT 255
#define PIN_IMU_INT_2 255
#define PIN_BATTERY_LEVEL 255
#define LED_PIN LED_OFF
#define LED_INVERTED false
#elif BOARD == BOARD_TTGO_TBASE
#define PIN_IMU_SDA 5
#define PIN_IMU_SCL 4
#define PIN_IMU_INT 14
#define PIN_IMU_INT_2 13
#define PIN_BATTERY_LEVEL A0
//  #define LED_PIN 2
//  #define LED_INVERTED false
#elif BOARD == BOARD_CUSTOM
// Define pins by the examples above
#elif BOARD == BOARD_WROOM32
#define PIN_IMU_SDA 21
#define PIN_IMU_SCL 22
#define PIN_IMU_INT 23
#define PIN_IMU_INT_2 25
#define PIN_BATTERY_LEVEL 36
//  #define LED_PIN 2
//  #define LED_INVERTED false
#elif BOARD == BOARD_LOLIN_C3_MINI
#define PIN_IMU_SDA 10
#define PIN_IMU_SCL 8
#define PIN_IMU_INT 6
#define PIN_IMU_INT_2 7
#define PIN_BATTERY_LEVEL 3
//  #define LED_PIN 2
//  #define LED_INVERTED false
#endif

固件编译、上传

固件编译、上传

上传前务必使用Micro USB连接D1 mini,且务必断开电池电源

修改完成后保存,1为编译,2为上传。

SlimeVR服务器安装

SlimeVR setup

下载安装包:slimevr_web_installer.exe,安装完成后打开追踪器可以看到追踪器数据。

服务端

owotrack

简介

使用手机作为多轴追踪硬件,实现简单动捕。

待续

Buy me a beer
Jake Liu
Never Settle

Title: 体验身体追踪VR开源方案

Author: Jake Liu

Origin:

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) For any re-post you must give appropriate credit.

文章遵循CC许可 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 转载请注明出处

Tag:VR, slimevr, owotrack

评论区

Add a new comment.

Theme