Skip to content

Commit

Permalink
Add flag to judge mouseRightPess.
Browse files Browse the repository at this point in the history
  • Loading branch information
liyixin135 committed Jul 8, 2024
1 parent 6438dd6 commit dd973ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/rm_manual/chassis_gimbal_shooter_manual.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
gimbal_cmd_sender_->setMode(rm_msgs::GimbalCmd::RATE);
if (shooter_cmd_sender_->getMsg()->mode == rm_msgs::ShootCmd::PUSH)
shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::READY);
turn_flag_ = false;
is_mouse_right_press_ = false;
}
void wPress() override;
void aPress() override;
Expand Down Expand Up @@ -122,7 +122,7 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
geometry_msgs::PointStamped point_out_;

bool prepare_shoot_ = false, turn_flag_ = false, is_balance_ = false, use_scope_ = false,
adjust_image_transmission_ = false;
adjust_image_transmission_ = false, is_mouse_right_press_ = false;
double yaw_current_{};
};
} // namespace rm_manual
6 changes: 4 additions & 2 deletions src/chassis_gimbal_shooter_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void ChassisGimbalShooterManual::remoteControlTurnOff()
shooter_calibration_->stop();
gimbal_calibration_->stop();
turn_flag_ = false;
is_mouse_right_press_ = false;
use_scope_ = false;
adjust_image_transmission_ = false;
}
Expand All @@ -207,6 +208,7 @@ void ChassisGimbalShooterManual::robotDie()
ManualBase::robotDie();
shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::STOP);
turn_flag_ = false;
is_mouse_right_press_ = false;
use_scope_ = false;
adjust_image_transmission_ = false;
}
Expand Down Expand Up @@ -344,7 +346,7 @@ void ChassisGimbalShooterManual::mouseLeftPress()
}
if (prepare_shoot_)
{
if (!turn_flag_ || (turn_flag_ && track_data_.id != 0))
if (!is_mouse_right_press_ || (is_mouse_right_press_ && track_data_.id != 0))
{
shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::PUSH);
shooter_cmd_sender_->checkError(ros::Time::now());
Expand All @@ -356,7 +358,7 @@ void ChassisGimbalShooterManual::mouseLeftPress()

void ChassisGimbalShooterManual::mouseRightPress()
{
turn_flag_ = true;
is_mouse_right_press_ = true;
if (track_data_.id == 0)
gimbal_cmd_sender_->setMode(rm_msgs::GimbalCmd::RATE);
else
Expand Down

0 comments on commit dd973ba

Please sign in to comment.