|
@@ -234,7 +234,14 @@ void SaturnController::taskModeCallback(const std_msgs::msg::Bool::SharedPtr tas
|
|
}
|
|
}
|
|
|
|
|
|
void SaturnController::mainTimerCallback() {
|
|
void SaturnController::mainTimerCallback() {
|
|
- rcClientInterfaceGetCommonStatus(&common_status_data_);
|
|
|
|
|
|
+ bool result = rcClientInterfaceGetCommonStatus(&common_status_data_);
|
|
|
|
+ if(is_getting_com_success == true && result == false){
|
|
|
|
+ is_getting_com_success = false;
|
|
|
|
+ SPDLOG_INFO("rcClientInterfaceGetCommonStatus starts to fail.");
|
|
|
|
+ } else if(is_getting_com_success == false && result == true){
|
|
|
|
+ is_getting_com_success = true;
|
|
|
|
+ SPDLOG_INFO("rcClientInterfaceGetCommonStatus starts to succeed.");
|
|
|
|
+ }
|
|
robot_heartbeat_ = common_status_data_.heartbeat;
|
|
robot_heartbeat_ = common_status_data_.heartbeat;
|
|
publishRobotState();
|
|
publishRobotState();
|
|
publishDockingState();
|
|
publishDockingState();
|
|
@@ -247,8 +254,14 @@ void SaturnController::mainTimerCallback() {
|
|
|
|
|
|
void SaturnController::imuTimerCallback() {
|
|
void SaturnController::imuTimerCallback() {
|
|
auto imu_message = sensor_msgs::msg::Imu();
|
|
auto imu_message = sensor_msgs::msg::Imu();
|
|
- rcClientInterfaceGetImuData(&imu_data_);
|
|
|
|
-
|
|
|
|
|
|
+ bool result = rcClientInterfaceGetImuData(&imu_data_);
|
|
|
|
+ if(is_getting_imu_success == true && result == false){
|
|
|
|
+ is_getting_imu_success = false;
|
|
|
|
+ SPDLOG_INFO("rcClientInterfaceGetImuData starts to fail.");
|
|
|
|
+ } else if(is_getting_imu_success == false && result == true){
|
|
|
|
+ is_getting_imu_success = true;
|
|
|
|
+ SPDLOG_INFO("rcClientInterfaceGetImuData starts to succeed.");
|
|
|
|
+ }
|
|
imu_message.header.stamp = rclcpp::Clock().now();
|
|
imu_message.header.stamp = rclcpp::Clock().now();
|
|
imu_message.header.frame_id = "imu";
|
|
imu_message.header.frame_id = "imu";
|
|
|
|
|
|
@@ -277,10 +290,17 @@ void SaturnController::leggedOodmTimerCallback() {
|
|
|
|
|
|
int64_t leg_odom_start_time = std::chrono::time_point_cast<std::chrono::nanoseconds> \
|
|
int64_t leg_odom_start_time = std::chrono::time_point_cast<std::chrono::nanoseconds> \
|
|
(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
|
|
(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
|
|
- rcClientInterfaceGetVisualFootholdState(&foothold_state_data_);
|
|
|
|
|
|
+ bool result = rcClientInterfaceGetVisualFootholdState(&foothold_state_data_);
|
|
int64_t leg_odom_end_time = std::chrono::time_point_cast<std::chrono::nanoseconds> \
|
|
int64_t leg_odom_end_time = std::chrono::time_point_cast<std::chrono::nanoseconds> \
|
|
(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
|
|
(std::chrono::high_resolution_clock::now()).time_since_epoch().count();
|
|
- //SPDLOG_INFO("time diff {} ",leg_odom_end_time-leg_odom_start_time);
|
|
|
|
|
|
+
|
|
|
|
+ if(is_getting_vf_success == true && result == false){
|
|
|
|
+ is_getting_vf_success = false;
|
|
|
|
+ SPDLOG_INFO("rcClientInterfaceGetVisualFootholdState starts to fail.");
|
|
|
|
+ } else if(is_getting_vf_success == false && result == true){
|
|
|
|
+ is_getting_vf_success = true;
|
|
|
|
+ SPDLOG_INFO("rcClientInterfaceGetVisualFootholdState starts to succeed.");
|
|
|
|
+ }
|
|
|
|
|
|
auto odometry_data = nav_msgs::msg::Odometry();
|
|
auto odometry_data = nav_msgs::msg::Odometry();
|
|
// odometry_data.header.stamp = rclcpp::Clock().now();
|
|
// odometry_data.header.stamp = rclcpp::Clock().now();
|