From 3fa7c25264ff2a08feffba215fff97339ce7df16 Mon Sep 17 00:00:00 2001 From: liyixin135 <421159734@qq.com> Date: Fri, 26 Jul 2024 21:48:19 +0800 Subject: [PATCH] Modify the method of count cycle. --- src/chassis_gimbal_shooter_cover_manual.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/chassis_gimbal_shooter_cover_manual.cpp b/src/chassis_gimbal_shooter_cover_manual.cpp index 195f85f3..019c0e54 100644 --- a/src/chassis_gimbal_shooter_cover_manual.cpp +++ b/src/chassis_gimbal_shooter_cover_manual.cpp @@ -225,13 +225,15 @@ void ChassisGimbalShooterCoverManual::mouseRightPress() { gimbal_cmd_sender_->setMode(rm_msgs::GimbalCmd::TRAJ); double traj_yaw = M_PI * count_ / 900; - double traj_pitch = 0.15 * sin(2 * M_PI * count_ / 900) + 0.2; - count_ = (count_ + 1) % 900; + double traj_pitch = 0.15 * sin(2 * M_PI * (count_ % 900) / 900) + 0.15; + count_++; gimbal_cmd_sender_->setYawAndPitchTraj(traj_yaw, traj_pitch); shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::READY); } else + { shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::PUSH); + } } else if (!mouse_left_event_.getState() && shooter_cmd_sender_->getMsg()->mode == rm_msgs::ShootCmd::PUSH) shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::READY);