diff --git a/go2_gym_deploy/unitree_sdk2_bin/lcm_position_go2.cpp b/go2_gym_deploy/unitree_sdk2_bin/lcm_position_go2.cpp index 91339e4..879da28 100644 --- a/go2_gym_deploy/unitree_sdk2_bin/lcm_position_go2.cpp +++ b/go2_gym_deploy/unitree_sdk2_bin/lcm_position_go2.cpp @@ -142,7 +142,7 @@ public: void Custom::InitRobotStateClient() { - rsc.SetTimeout(10.0f); + rsc.SetTimeout(5.0f); rsc.Init(); } @@ -229,7 +229,6 @@ void Custom::lcm_send(){ rc_command.left_lower_left_switch = key.components.L2; rc_command.left_upper_switch = key.components.L1; - // 这里的mode是用来控制啥的? if(key.components.A > 0){ mode = 0; } else if(key.components.B > 0){ @@ -357,7 +356,7 @@ void Custom::LowCmdWrite(){ // 写了一段安全冗余代码 // 当roll角超过限制,或pitch角超过限制,或遥控器按下L2+B键 // if ( low_state.imu_state().rpy()[0] > 0.5 || low_state.imu_state().rpy()[1] > 0.5 || ((int)key.components.B==1 && (int)key.components.L2==1)) - if ( std::abs(low_state.imu_state().rpy()[0]) > 0.5 || std::abs(low_state.imu_state().rpy()[1]) > 0.5 || ((int)key.components.B==1 && (int)key.components.L2==1)) + if ( std::abs(low_state.imu_state().rpy()[0]) > 0.8 || std::abs(low_state.imu_state().rpy()[1]) > 0.8 || ((int)key.components.B==1 && (int)key.components.L2==1)) { for (int i = 0; i < 12; i++){ // 进入damping模式 @@ -368,44 +367,41 @@ void Custom::LowCmdWrite(){ low_cmd.motor_cmd()[i].tau() = 0; } std::cout << "======= Switched to Damping Mode, and the thread is sleeping ========"<>> Unitree SDK2" << std::endl; + std::cout<<"------------------------------------" << std::endl; + std::cout<<"------------------------------------" << std::endl; + std::cout<<"Press L2+B if any unexpected error occurs" << std::endl; break; + }else{ - sleep(0.1); + std::cout << "======= Press [L2+B] again to exit ========"<