From 0dd508f3112c245b7a4be0880ecbccc926c93483 Mon Sep 17 00:00:00 2001 From: youjian <1124895509@qq.com> Date: Sun, 24 Mar 2024 13:50:29 +0800 Subject: [PATCH 1/3] Avoid capacity keep in charge mode when chassis rotate. --- include/rm_manual/chassis_gimbal_shooter_manual.h | 1 + src/chassis_gimbal_shooter_manual.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/rm_manual/chassis_gimbal_shooter_manual.h b/include/rm_manual/chassis_gimbal_shooter_manual.h index e86618da..86132895 100644 --- a/include/rm_manual/chassis_gimbal_shooter_manual.h +++ b/include/rm_manual/chassis_gimbal_shooter_manual.h @@ -83,6 +83,7 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual virtual void eRelease(); virtual void cPress(); virtual void bPress(); + virtual void bRelease(); virtual void rPress(); virtual void xReleasing(); virtual void shiftPress(); diff --git a/src/chassis_gimbal_shooter_manual.cpp b/src/chassis_gimbal_shooter_manual.cpp index f37f2b20..183c8eea 100644 --- a/src/chassis_gimbal_shooter_manual.cpp +++ b/src/chassis_gimbal_shooter_manual.cpp @@ -47,7 +47,8 @@ ChassisGimbalShooterManual::ChassisGimbalShooterManual(ros::NodeHandle& nh, ros: q_event_.setEdge(boost::bind(&ChassisGimbalShooterManual::qPress, this), boost::bind(&ChassisGimbalShooterManual::qRelease, this)); f_event_.setRising(boost::bind(&ChassisGimbalShooterManual::fPress, this)); - b_event_.setRising(boost::bind(&ChassisGimbalShooterManual::bPress, this)); + b_event_.setEdge(boost::bind(&ChassisGimbalShooterManual::bPress, this), + boost::bind(&ChassisGimbalShooterManual::bRelease, this)); x_event_.setRising(boost::bind(&ChassisGimbalShooterManual::xPress, this)); x_event_.setActiveLow(boost::bind(&ChassisGimbalShooterManual::xReleasing, this)); r_event_.setRising(boost::bind(&ChassisGimbalShooterManual::rPress, this)); @@ -399,6 +400,11 @@ void ChassisGimbalShooterManual::bPress() chassis_cmd_sender_->power_limit_->updateState(rm_common::PowerLimit::CHARGE); } +void ChassisGimbalShooterManual::bRelease() +{ + chassis_cmd_sender_->power_limit_->updateState(rm_common::PowerLimit::NORMAL); +} + void ChassisGimbalShooterManual::rPress() { if (camera_switch_cmd_sender_) From a89c2e6e8900bb95939da90af9e3e5bbad15172d Mon Sep 17 00:00:00 2001 From: youjian <1124895509@qq.com> Date: Mon, 25 Mar 2024 19:39:49 +0800 Subject: [PATCH 2/3] Avoid the rotating chassis going into CHARGE mode when the shift key is pressed. --- src/chassis_gimbal_shooter_manual.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chassis_gimbal_shooter_manual.cpp b/src/chassis_gimbal_shooter_manual.cpp index 183c8eea..ca591080 100644 --- a/src/chassis_gimbal_shooter_manual.cpp +++ b/src/chassis_gimbal_shooter_manual.cpp @@ -567,10 +567,11 @@ void ChassisGimbalShooterManual::vPress() void ChassisGimbalShooterManual::shiftPress() { - if (chassis_cmd_sender_->getMsg()->mode != rm_msgs::ChassisCmd::FOLLOW) + if (chassis_cmd_sender_->getMsg()->mode != rm_msgs::ChassisCmd::FOLLOW || is_gyro_) { chassis_cmd_sender_->setMode(rm_msgs::ChassisCmd::FOLLOW); - vel_cmd_sender_->setAngularZVel(0.); + vel_cmd_sender_->setAngularZVel(1.0); + is_gyro_ = false; } chassis_cmd_sender_->power_limit_->updateState(rm_common::PowerLimit::BURST); } From 44d6df498e095d30925306bfe57ee814d140bfdf Mon Sep 17 00:00:00 2001 From: youjian <1124895509@qq.com> Date: Mon, 25 Mar 2024 19:47:04 +0800 Subject: [PATCH 3/3] Fix a logic problem. --- src/chassis_gimbal_shooter_manual.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chassis_gimbal_shooter_manual.cpp b/src/chassis_gimbal_shooter_manual.cpp index ca591080..4d22edd8 100644 --- a/src/chassis_gimbal_shooter_manual.cpp +++ b/src/chassis_gimbal_shooter_manual.cpp @@ -567,7 +567,7 @@ void ChassisGimbalShooterManual::vPress() void ChassisGimbalShooterManual::shiftPress() { - if (chassis_cmd_sender_->getMsg()->mode != rm_msgs::ChassisCmd::FOLLOW || is_gyro_) + if (chassis_cmd_sender_->getMsg()->mode != rm_msgs::ChassisCmd::FOLLOW && is_gyro_) { chassis_cmd_sender_->setMode(rm_msgs::ChassisCmd::FOLLOW); vel_cmd_sender_->setAngularZVel(1.0);