Spaces:
Running
Running
File size: 1,048 Bytes
130ae50 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
/**
* Constants for lerobot.js
* Mirrors Python lerobot/common/constants.py
*/
import { homedir } from "os";
import { join } from "path";
// Device types
export const ROBOTS = "robots";
export const TELEOPERATORS = "teleoperators";
/**
* Get HF Home directory
* Equivalent to Python's huggingface_hub.constants.HF_HOME
*/
export function getHfHome(): string {
if (process.env.HF_HOME) {
return process.env.HF_HOME;
}
const homeDir = homedir();
return join(homeDir, ".cache", "huggingface");
}
/**
* Get HF lerobot home directory
* Equivalent to Python's HF_LEROBOT_HOME
*/
export function getHfLerobotHome(): string {
if (process.env.HF_LEROBOT_HOME) {
return process.env.HF_LEROBOT_HOME;
}
return join(getHfHome(), "lerobot");
}
/**
* Get calibration directory
* Equivalent to Python's HF_LEROBOT_CALIBRATION
*/
export function getCalibrationDir(): string {
if (process.env.HF_LEROBOT_CALIBRATION) {
return process.env.HF_LEROBOT_CALIBRATION;
}
return join(getHfLerobotHome(), "calibration");
}
|