Files
lzwc-terminal-unitreeGo2/include/config.hpp

74 lines
1.8 KiB
C++

#pragma once
#include <string>
#include <string_view>
namespace custom {
/**
* @brief Robot motion gait types
*/
enum class Gait : int {
IDLE = 0, // Standing still
TROT = 1, // Normal walking
TROT_RUNNING = 2 // Fast running
};
// Network settings
constexpr std::string_view NETWORK_INTERFACE = "eth0";
// MQTT settings
constexpr std::string_view MQTT_BROKER = "192.168.2.236";
constexpr int MQTT_PORT = 1883;
constexpr std::string_view MQTT_CLIENT_ID = "unitree_go2_client";
constexpr std::string_view MQTT_USERNAME = "lzwc";
constexpr std::string_view MQTT_PASSWORD = "Lzwc@4187.";
// Topic settings
constexpr std::string_view TOPIC_PREFIX = "unitree/go2";
constexpr std::string_view TOPIC_CMD = "cmd";
constexpr std::string_view TOPIC_STATE = "state";
// Robot control settings
constexpr double CONTROL_FREQUENCY = 200.0; // Hz
constexpr double STATE_PUBLISH_FREQUENCY = 50.0; // Hz
// Safety settings
constexpr double MAX_LINEAR_VELOCITY = 1.5; // m/s
constexpr double MAX_ANGULAR_VELOCITY = 2.0; // rad/s
constexpr double EMERGENCY_STOP_TIMEOUT = 5.0; // seconds
// Motion settings
constexpr double STAND_HEIGHT = 0.0; // relative height
constexpr Gait DEFAULT_GAIT = Gait::IDLE;
class CustomConfig {
public:
std::string network_interface;
std::string mqtt_broker;
int mqtt_port;
std::string mqtt_username;
std::string mqtt_password;
std::string mqtt_client_id;
std::string topic_prefix;
std::string topic_cmd;
std::string topic_state;
double control_frequency;
double state_publish_frequency;
double max_linear_velocity;
double max_angular_velocity;
double emergency_stop_timeout;
double stand_height;
int default_gait;
void loadDefaults();
};
} // namespace custom