#ifndef UNITREE_SDK2_BRIDGE_H #define UNITREE_SDK2_BRIDGE_H #include #include #include #include #include #include #include #include #include using namespace unitree::common; using namespace unitree::robot; using namespace std; #define TOPIC_LOWSTATE "rt/lowstate" #define TOPIC_HIGHSTATE "rt/sportmodestate" #define TOPIC_LOWCMD "rt/lowcmd" #define MOTOR_SENSOR_NUM 3 class UnitreeSdk2Bridge { public: UnitreeSdk2Bridge(mjModel *model, mjData *data); ~UnitreeSdk2Bridge(); void LowCmdHandler(const void *msg); void PublishLowState(); void PublishHighState(); void Run(); void PrintSceneInformation(); void CheckSensor(); unitree_go::msg::dds_::LowState_ low_state{}; unitree_go::msg::dds_::SportModeState_ high_state{}; ChannelPublisherPtr low_state_puber_; ChannelPublisherPtr high_state_puber_; ChannelSubscriberPtr low_cmd_suber_; ThreadPtr lowStatePuberThreadPtr; ThreadPtr HighStatePuberThreadPtr; mjData *mj_data_; mjModel *mj_model_; int num_motor_ = 0; int dim_motor_sensor_ = 0; int have_imu_ = false; int have_frame_sensor_ = false; }; #endif