Skip to content

Commit

Permalink
Merge pull request #1 from BlanchardLj/traj
Browse files Browse the repository at this point in the history
Modify wrong of unable to be auto when press mouseRight twice
  • Loading branch information
liyixin135 authored Jul 10, 2024
2 parents daea52a + 542fb1f commit b234d32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 0 additions & 5 deletions include/rm_manual/chassis_gimbal_shooter_manual.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
void mouseRightPress();
void mouseRightRelease()
{
if (is_auto_)
{
is_auto_ = false;
count_ = 0;
}
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);
Expand Down
13 changes: 9 additions & 4 deletions src/chassis_gimbal_shooter_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,17 @@ void ChassisGimbalShooterManual::judgeIsAuto()
{
last_time_hit_by_dart_ = time_hit_by_dart_;
hit_time_ = ros::Time::now();
is_auto_ = true;
}
if ((target_hit_by_dart_ == 1 && (ros::Time::now() - hit_time_).toSec() >= 5) ||
(target_hit_by_dart_ == 2 && (ros::Time::now() - hit_time_).toSec() >= 10) ||
(target_hit_by_dart_ == 3 && (ros::Time::now() - hit_time_).toSec() >= 15))
if (((target_hit_by_dart_ == 1 && (ros::Time::now() - hit_time_).toSec() <= 5) ||
(target_hit_by_dart_ == 2 && (ros::Time::now() - hit_time_).toSec() <= 10) ||
(target_hit_by_dart_ == 3 && (ros::Time::now() - hit_time_).toSec() <= 15)) &&
mouse_right_event_.getState())
is_auto_ = true;
else
{
is_auto_ = false;
count_ = 0;
}
if (target_hit_by_dart_ == 0)
is_auto_ = false;
}
Expand Down

0 comments on commit b234d32

Please sign in to comment.