Skip to content

Configuration

Twometer edited this page Jun 26, 2020 · 14 revisions

The configuration files reside in the %LOCALAPPDATA%\TwometerVR directory. Its structure is as follows:

  • Config.yml: General settings about the camera, the room, inputs etc.
  • CameraProfiles
    • <camera-id>.yml: Files for each registered camera

All length and position values are given in meters.

Config.yml

This file has the following basic structure:

  • CameraInfo
    • Index: <int>: The DirectShow device index of the camera (automatically calculated by the assistant)
    • ProfileName: <string>: The identifier (filename without extension) of the camera profile currently in use
  • Offset: A 3D vector that offsets the position of the controllers
    • X: <float>: Offset in x-direction, rarely used
    • Y: <float>: How high your camera is above the ground, so that the service can adjust for that
    • Z: <float>: How far away you are from the camera. The coordinate system is arranged so that the Z axis points away from the camera. Therefore, you need to specify the negative of the distance.
  • HardwareConfig
    • SphereSize: <float>: The real-life diameter of the glowing spheres on top of the controllers. Will be 0.04 meters if you use my build files.
    • SphereDistance: <float>: How far away the sphere is from the origin of rotation (the IMU). Currently not used, but can be used in the future for correcting the rotational offset.
  • InputConfig
    • PoseResetDelay: <float>: The duration, in seconds, for which both buttons of the controllers have to be pressed to execute a Pose Reset.
    • UpdateRate: <int>: The rate, in Hertz (updates per second), that the service should send new data to SteamVR
    • Latency: <int>: The latency of the controller position: Higher latency means smoother movement, but more delay, and vice versa. For movement-critical applications such as Beat Saber, I recommend a value of around 2.

Camera Profiles

The camera profile files are within the CameraProfiles directory mentioned above. They are named after their camera identifier and they must use the extension .yml, or the service won't find them.

Camera identifiers

The identifiers are built using the following rules: Convert the name of the camera as reported by the system to lowercase, drop all characters from it that are non-alphanumeric, and replace all spaces with dashes (-).

File structure

  • Identifier: <string>: Camera identifier, as discussed above
  • Model: <string>: The unmodified camera name
  • Manufacturer: <string>: Camera manufacturer, currently unused
  • CameraParameters:
    • FrameWidth and FrameHeight: The size of the tracking frame. Set this to the maximum, for example, for a Full HD webcam, use FrameWidth: 1920 and FrameHeight: 1080 to get the maximum tracking space. If you can't use the maximum resolution because of CPU power restrictions, use a lower resolution but the maximum aspect ratio, e.g. 1280x720.
    • FocalLength: <int>: The perceived focal length of the camera. This has no unit, and is automatically calculated by the setup assistant.
    • PixelsPerMeter: <int>: How many pixels correspond to one meter at a distance of 1 meter
  • CalibrationParameters_
    • BrightnessThreshold: <int>: At startup, the camera calibrates by reducing exposure until the mean brightness of all pixels is below this threshold. If the tracking is bad, you may want to adjust this value. The debug view in the service UI (Service > Debug...) may help with that as well.
    • WarmupFrames: <int>: How many frames to wait for the camera to adjust after initialization
    • CooldownFrames: <int>: How many frames to wait after adjusting exposure until measuring brightness
    • StableFrames: <int>: If the brightness does not change after adjusting the exposure for this amount of frames, calibration mode will be quit. This prevents infinite calibration in case the brightness threshold is below the minimum exposure level of the camera.
  • ColorProfiles: This defines the color ranges for the red and blue controllers. The order is important: first is left and second is blue.
    • ColorRanges: Each profile can have multiple color ranges in HSV (e.g. red needs that because it crosses 360° on the hue circle)
      • Minimum: The minimum HSV (object with H [0...180], S [0...255], V [0...255] values) for this range
      • Maximum: The maximum HSV (same format) for this range

HSV Color format

You may have noticed a weird range of values for the HSV color format. This is the way OpenCV (the used computer vision library), expects HSV values. Instead of 0...360°, hue is in range 0...180°. Saturation (S) and Value (V) are each in the range of 0...255.

For makers

For developers

For everyone

Clone this wiki locally