Skip to content

Commit

Permalink
Merge pull request #231 from liyixin135/dif_tolerance
Browse files Browse the repository at this point in the history
Add gimbal_buff_error_tolerance when tracking buff
  • Loading branch information
d0h0s authored Jul 18, 2024
2 parents dba1ee0 + 110df27 commit 4f9a8a4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions rm_common/include/rm_common/decision/command_sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,14 @@ class ShooterCommandSender : public TimeStampCommandSenderBase<rm_msgs::ShootCmd
nh.getParam("wheel_speed_18", wheel_speed_18_);
nh.getParam("wheel_speed_30", wheel_speed_30_);
nh.param("extra_wheel_speed_once", extra_wheel_speed_once_, 0.);
if (!nh.getParam("gimbal_error_tolerance", gimbal_error_tolerance_))
ROS_ERROR("gimbal error tolerance no defined (namespace: %s)", nh.getNamespace().c_str());
if (!nh.getParam("target_acceleration_tolerance", target_acceleration_tolerance_))
{
target_acceleration_tolerance_ = 0.;
ROS_INFO("target_acceleration_tolerance no defined(namespace: %s), set to zero.", nh.getNamespace().c_str());
}
if (!nh.getParam("track_armor_error_tolerance", track_armor_error_tolerance_))
ROS_ERROR("track armor error tolerance no defined (namespace: %s)", nh.getNamespace().c_str());
nh.param("track_buff_error_tolerance", track_buff_error_tolerance_, track_armor_error_tolerance_);
}
~ShooterCommandSender()
{
Expand Down Expand Up @@ -409,7 +410,8 @@ class ShooterCommandSender : public TimeStampCommandSenderBase<rm_msgs::ShootCmd
return;
}
}
if (((gimbal_des_error_.error > gimbal_error_tolerance_ && time - gimbal_des_error_.stamp < ros::Duration(0.1)) ||
double gimbal_error_tolerance = track_data_.id == 12 ? track_buff_error_tolerance_ : track_armor_error_tolerance_;
if (((gimbal_des_error_.error > gimbal_error_tolerance && time - gimbal_des_error_.stamp < ros::Duration(0.1)) ||
(track_data_.accel > target_acceleration_tolerance_)) ||
(!suggest_fire_.data && armor_type_ == rm_msgs::StatusChangeRequest::ARMOR_OUTPOST_BASE))
if (msg_.mode == rm_msgs::ShootCmd::PUSH)
Expand Down Expand Up @@ -494,7 +496,8 @@ class ShooterCommandSender : public TimeStampCommandSenderBase<rm_msgs::ShootCmd
double speed_10_{}, speed_15_{}, speed_16_{}, speed_18_{}, speed_30_{}, speed_des_{};
double wheel_speed_10_{}, wheel_speed_15_{}, wheel_speed_16_{}, wheel_speed_18_{}, wheel_speed_30_{},
wheel_speed_des_{};
double gimbal_error_tolerance_{};
double track_armor_error_tolerance_{};
double track_buff_error_tolerance_{};
double target_acceleration_tolerance_{};
double extra_wheel_speed_once_{};
double total_extra_wheel_speed_{};
Expand Down

0 comments on commit 4f9a8a4

Please sign in to comment.