Implement MQTT functionality in CustomRobot class. Added methods for MQTT initialization, message handling, and connection management. Updated configuration to remove multimedia settings and streamline MQTT-related parameters. Enhanced logging for MQTT operations and ensured proper cleanup during shutdown.
This commit is contained in:
@@ -29,8 +29,6 @@ constexpr std::string_view MQTT_PASSWORD = "";
|
||||
constexpr std::string_view TOPIC_PREFIX = "unitree/go2";
|
||||
constexpr std::string_view TOPIC_CMD = "cmd";
|
||||
constexpr std::string_view TOPIC_STATE = "state";
|
||||
constexpr std::string_view TOPIC_VIDEO = "video";
|
||||
constexpr std::string_view TOPIC_AUDIO = "audio";
|
||||
|
||||
// Robot control settings
|
||||
constexpr double CONTROL_FREQUENCY = 200.0; // Hz
|
||||
@@ -45,18 +43,6 @@ constexpr double EMERGENCY_STOP_TIMEOUT = 5.0; // seconds
|
||||
constexpr double STAND_HEIGHT = 0.0; // relative height
|
||||
constexpr Gait DEFAULT_GAIT = Gait::IDLE;
|
||||
|
||||
// Video settings
|
||||
constexpr int VIDEO_WIDTH = 1280;
|
||||
constexpr int VIDEO_HEIGHT = 720;
|
||||
constexpr int VIDEO_FPS = 30;
|
||||
constexpr std::string_view VIDEO_FORMAT = "h264";
|
||||
constexpr bool VIDEO_ENABLED = true;
|
||||
|
||||
// Audio settings
|
||||
constexpr int AUDIO_SAMPLE_RATE = 16000;
|
||||
constexpr int AUDIO_CHANNELS = 1;
|
||||
constexpr std::string_view AUDIO_FORMAT = "pcm";
|
||||
constexpr bool AUDIO_ENABLED = true;
|
||||
|
||||
class CustomConfig {
|
||||
public:
|
||||
@@ -72,8 +58,6 @@ public:
|
||||
std::string topic_prefix;
|
||||
std::string topic_cmd;
|
||||
std::string topic_state;
|
||||
std::string topic_video;
|
||||
std::string topic_audio;
|
||||
|
||||
// 机器人控制和安全
|
||||
double control_frequency;
|
||||
@@ -84,16 +68,6 @@ public:
|
||||
double stand_height;
|
||||
int default_gait;
|
||||
|
||||
// 多媒体
|
||||
bool enable_video;
|
||||
bool enable_audio;
|
||||
int video_width;
|
||||
int video_height;
|
||||
int video_fps;
|
||||
std::string video_format;
|
||||
int audio_sample_rate;
|
||||
int audio_channels;
|
||||
std::string audio_format;
|
||||
|
||||
void loadDefaults();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user