|
@@ -208,8 +208,6 @@ void SaturnController::robotCommandCallback(
|
|
|
|
|
|
void SaturnController::guardianCallback(
|
|
|
const daystar_navigation_msgs::msg::Guardian::SharedPtr guardian_msg) {
|
|
|
- //SPDLOG_INFO("guardianCallback {} velocity_decay_ratio {}",
|
|
|
- // guardian_msg->trigger_source.c_str(), guardian_msg->velocity_decay_ratio);
|
|
|
float velocity_decay_ratio = guardian_msg->velocity_decay_ratio;
|
|
|
std::string trigger_source = guardian_msg->trigger_source;
|
|
|
rcClientInterfaceSetGuardian(robot_control::common::NAV_OR_JOY_MODE::nav_control,
|
|
@@ -238,10 +236,26 @@ void SaturnController::mainTimerCallback() {
|
|
|
if(is_getting_com_success == true && result == false){
|
|
|
is_getting_com_success = false;
|
|
|
SPDLOG_INFO("rcClientInterfaceGetCommonStatus starts to fail.");
|
|
|
+
|
|
|
+ //重新init
|
|
|
+ if (rcClientInterfaceInit(config_handler_->motion_computer_ip_address_) == false) {
|
|
|
+ RCLCPP_ERROR(node_->get_logger(), "rcClientInterfaceInit failed with %s",
|
|
|
+ config_handler_->motion_computer_ip_address_.c_str());
|
|
|
+ }
|
|
|
+
|
|
|
} else if(is_getting_com_success == false && result == true){
|
|
|
is_getting_com_success = true;
|
|
|
SPDLOG_INFO("rcClientInterfaceGetCommonStatus starts to succeed.");
|
|
|
+ } else if(is_getting_com_success == false && result == false){
|
|
|
+ reconnect_count ++;
|
|
|
+ if(reconnect_count % 500 == 0) {
|
|
|
+ if (rcClientInterfaceInit(config_handler_->motion_computer_ip_address_) == false) {
|
|
|
+ SPDLOG_INFO(node_->get_logger(), "rcClientInterfaceInit failed with %s",
|
|
|
+ config_handler_->motion_computer_ip_address_.c_str());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
robot_heartbeat_ = common_status_data_.heartbeat;
|
|
|
publishRobotState();
|
|
|
publishDockingState();
|
|
@@ -258,10 +272,27 @@ void SaturnController::imuTimerCallback() {
|
|
|
if(is_getting_imu_success == true && result == false){
|
|
|
is_getting_imu_success = false;
|
|
|
SPDLOG_INFO("rcClientInterfaceGetImuData starts to fail.");
|
|
|
+
|
|
|
+ //重新init
|
|
|
+ if (rcClientInterfaceInit(config_handler_->motion_computer_ip_address_) == false) {
|
|
|
+ RCLCPP_ERROR(node_->get_logger(), "rcClientInterfaceInit failed with %s",
|
|
|
+ config_handler_->motion_computer_ip_address_.c_str());
|
|
|
+ }
|
|
|
+
|
|
|
} else if(is_getting_imu_success == false && result == true){
|
|
|
is_getting_imu_success = true;
|
|
|
SPDLOG_INFO("rcClientInterfaceGetImuData starts to succeed.");
|
|
|
+ } else if(is_getting_imu_success == false && result == false){
|
|
|
+ reconnect_count ++;
|
|
|
+ if(reconnect_count % 500 == 0) {
|
|
|
+ if (rcClientInterfaceInit(config_handler_->motion_computer_ip_address_) == false) {
|
|
|
+ SPDLOG_INFO(node_->get_logger(), "rcClientInterfaceInit failed with %s",
|
|
|
+ config_handler_->motion_computer_ip_address_.c_str());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
imu_message.header.stamp = rclcpp::Clock().now();
|
|
|
imu_message.header.frame_id = "imu";
|
|
|
|
|
@@ -296,10 +327,19 @@ void SaturnController::leggedOodmTimerCallback() {
|
|
|
|
|
|
if(is_getting_vf_success == true && result == false){
|
|
|
is_getting_vf_success = false;
|
|
|
- SPDLOG_INFO("rcClientInterfaceGetVisualFootholdState starts to fail.");
|
|
|
+ SPDLOG_INFO("rcClientInterfaceGetVisualFootholdState starts to fail. Tried to reconnect.");
|
|
|
+
|
|
|
} else if(is_getting_vf_success == false && result == true){
|
|
|
is_getting_vf_success = true;
|
|
|
SPDLOG_INFO("rcClientInterfaceGetVisualFootholdState starts to succeed.");
|
|
|
+ } else if(is_getting_vf_success == false && result == false){
|
|
|
+ reconnect_count ++;
|
|
|
+ if(reconnect_count % 500 == 0) {
|
|
|
+ if (rcClientInterfaceInit(config_handler_->motion_computer_ip_address_) == false) {
|
|
|
+ SPDLOG_INFO(node_->get_logger(), "rcClientInterfaceInit failed with %s",
|
|
|
+ config_handler_->motion_computer_ip_address_.c_str());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
auto odometry_data = nav_msgs::msg::Odometry();
|