Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/rm_manual/chassis_gimbal_manual.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ChassisGimbalManual : public ManualBase
rm_common::ChassisCommandSender* chassis_cmd_sender_{};

double x_scale_{}, y_scale_{};
bool is_gyro_{ 0 }, wheels_offline_ = false;
bool is_gyro_{ false }, wheels_offline_{ false };
double speed_change_scale_{ 1. };
double gimbal_scale_{ 1. };
double traj_scale_{ 0.5 };
Expand Down
31 changes: 12 additions & 19 deletions include/rm_manual/chassis_gimbal_shooter_cover_manual.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,21 @@ class ChassisGimbalShooterCoverManual : public ChassisGimbalShooterManual
void changeSpeedMode(SpeedMode speed_mode);
double getDynamicScale(const double base_scale, const double amplitude, const double period, const double phase);
void changeGyroSpeedMode(SpeedMode speed_mode);
void checkWheelsOnline();
void updatePc(const rm_msgs::DbusData::ConstPtr& dbus_data) override;
void checkKeyboard(const rm_msgs::DbusData::ConstPtr& dbus_data) override;
void checkReferee() override;
void sendCommand(const ros::Time& time) override;
void updateWheelsState(const rm_ecat_msgs::RmEcatStandardSlaveReadings::ConstPtr& data,
const std::vector<std::string>& chassis_motor);
void rightSwitchDownRise() override;
void rightSwitchMidRise() override;
void rightSwitchUpRise() override;
void wheelsOnlineCallback(const rm_ecat_msgs::RmEcatStandardSlaveReadings::ConstPtr& data);
void gameRobotStatusCallback(const rm_msgs::GameRobotStatus::ConstPtr& data) override;
void mouseRightPress() override;
void ePress() override;
void eRelease() override;
void bPress() override;
void cPress() override;
void qPress() override;
void ctrlRPressing();
void ctrlRRelease() override;
void ctrlRRelease();
void wPress() override;
void wPressing() override;
void aPressing() override;
Expand All @@ -50,15 +46,17 @@ class ChassisGimbalShooterCoverManual : public ChassisGimbalShooterManual
void aRelease() override;
void sRelease() override;
void dRelease() override;
void bRelease() override
{
}
void zPress() override
{
}

virtual void ctrlZPress();
virtual void ctrlZRelease()
void ctrlCPress() override
{
gimbal_cmd_sender_->setMode(rm_msgs::GimbalCmd::RATE);
};
}
virtual void ctrlZPress();
virtual void ctrlZRelease();
virtual void ctrlXPress();

ros::Subscriber wheel_online_sub_;
Expand All @@ -70,17 +68,12 @@ class ChassisGimbalShooterCoverManual : public ChassisGimbalShooterManual
rm_common::SwitchDetectionCaller* switch_buff_srv_{};
rm_common::SwitchDetectionCaller* switch_buff_type_srv_{};
rm_common::SwitchDetectionCaller* switch_exposure_srv_{};
rm_common::JointPositionBinaryCommandSender* cover_command_sender_{};
InputEvent ctrl_z_event_, z_event_;
std::string supply_frame_;
std::string wireless_frame_;
ros::Time last_switch_time_, last_check_wheels_time_;
std::vector<std::string> chassis_motor_;
std::vector<bool> wheels_online_state_;
bool supply_ = false;
bool need_wireless_ = false;
bool cover_close_ = true;
bool last_power_chassis_output_ = false;
ros::Time last_switch_time_;
bool supply_ = { false };
bool need_wireless_ = { false };
int count_{};
};
} // namespace rm_manual
56 changes: 37 additions & 19 deletions include/rm_manual/chassis_gimbal_shooter_manual.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#include "rm_manual/chassis_gimbal_manual.h"
#include <rm_common/decision/calibration_queue.h>
#include <std_srvs/Empty.h>
#include <angles/angles.h>
#include <unordered_set>

namespace rm_manual
{
Expand All @@ -19,10 +21,14 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
protected:
void ecatReconnected() override;
void checkReferee() override;
void checkWheelsOnline();
void checkKeyboard(const rm_msgs::DbusData::ConstPtr& dbus_data) override;
void updateRc(const rm_msgs::DbusData::ConstPtr& dbus_data) override;
void updatePc(const rm_msgs::DbusData::ConstPtr& dbus_data) override;
void sendCommand(const ros::Time& time) override;
void updateWheelsState(const rm_ecat_msgs::RmEcatStandardSlaveReadings::ConstPtr& data,
const std::vector<std::string>& chassis_motor);
void wheelsOnlineCallback(const rm_ecat_msgs::RmEcatStandardSlaveReadings::ConstPtr& data);
void chassisOutputOn() override;
void shooterOutputOn() override;
void gimbalOutputOn() override;
Expand All @@ -37,7 +43,6 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
void remoteControlTurnOff() override;
void remoteControlTurnOn() override;
void robotDie() override;
void robotRevive() override;
void rightSwitchDownRise() override;
void rightSwitchMidRise() override;
void rightSwitchUpRise() override;
Expand All @@ -54,6 +59,8 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
void suggestFireCallback(const std_msgs::Bool::ConstPtr& data) override;
void trackCallback(const rm_msgs::TrackData::ConstPtr& data) override;
void shootDataCallback(const rm_msgs::ShootData::ConstPtr& data) override;
void ballisticSolutionCallback(const std_msgs::Float32MultiArray::ConstPtr& data) override;
void protectStateCallback(const std_msgs::Bool::ConstPtr& data) override;
void leftSwitchUpOn(ros::Duration duration);
void leftSwitchUpFall();
void mouseLeftPress();
Expand All @@ -62,13 +69,14 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::READY);
prepare_shoot_ = true;
}
void mouseRightPress();
virtual void mouseRightPress();
void mouseRightRelease()
{
if (deployed_)
return;
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);
}
void mouseRightRising();
void wPress() override;
void aPress() override;
void sPress() override;
Expand All @@ -94,12 +102,8 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
virtual void shiftPress();
virtual void shiftRelease();
virtual void rPress();
virtual void qPress()
{
}
virtual void qRelease()
{
}
virtual void qPress();

void ctrlFPress()
{
shooter_cmd_sender_->setMode(rm_msgs::ShootCmd::STOP);
Expand All @@ -108,31 +112,45 @@ class ChassisGimbalShooterManual : public ChassisGimbalManual
void ctrlRPress();
void ctrlZPress();
void ctrlXPress();
virtual void ctrlRRelease();
virtual void ctrlCPress();
virtual void ctrlQPress();
virtual void ctrlBPress();

InputEvent self_inspection_event_, game_start_event_, e_event_, c_event_, g_event_, q_event_, b_event_, x_event_,
r_event_, v_event_, z_event_, ctrl_f_event_, ctrl_v_event_, ctrl_b_event_, ctrl_q_event_, ctrl_r_event_,
ctrl_z_event_, ctrl_x_event_, shift_event_, ctrl_shift_b_event_, mouse_left_event_, mouse_right_event_;
ctrl_z_event_, ctrl_c_event_, ctrl_x_event_, shift_event_, mouse_left_event_, mouse_right_event_;
rm_common::ShooterCommandSender* shooter_cmd_sender_{};
rm_common::CameraSwitchCommandSender* camera_switch_cmd_sender_{};
rm_common::JointPositionBinaryCommandSender* scope_cmd_sender_{};
rm_common::JointPositionBinaryCommandSender* image_transmission_cmd_sender_{};
rm_common::ChassisActiveSuspensionCommandSender* chassis_active_sus_cmd_sender_{};
rm_common::BallisticSolverRequestCommandSender* ballistic_solver_request_cmd_sender_{};

rm_common::SwitchDetectionCaller* switch_detection_srv_{};
rm_common::SwitchDetectionCaller* switch_detection_left_srv_{};
rm_common::SwitchDetectionCaller* switch_armor_target_srv_{};
rm_common::ServiceCallerBase<std_srvs::Empty>* relocate_srv_{};
rm_common::ColorChangeServiceCaller* color_change_srv_{};
rm_common::TrackerResetServiceCaller* tracker_reset_srv_{};

rm_common::CalibrationQueue* chassis_calibration_;
rm_common::CalibrationQueue* shooter_calibration_;
rm_common::CalibrationQueue* gimbal_calibration_;

geometry_msgs::PointStamped point_out_;
uint8_t last_shoot_freq_{};
ros::Subscriber wheel_online_sub_;
ros::Time last_wheels_power_time_;
std::vector<std::string> chassis_motor_;
std::vector<bool> wheels_online_state_;

bool prepare_shoot_ = false, is_balance_ = false, use_scope_ = false, adjust_image_transmission_ = false,
up_change_position_ = false, low_change_position_ = false, need_change_position_ = false, deployed_ = false;
double yaw_current_{};
double traj_yaw_, traj_pitch_;
double scale_;
std_msgs::Float32MultiArray ballistic_solution_;
ros::Time last_ballistic_solution_request_time_;

bool prepare_shoot_{ false }, is_balance_{ false }, use_scope_{ false }, deployed_{ false },
is_follow_yaw_reverse_{ false }, all_wheel_offline_{ false }, protect_state_{ false };
double ballistic_yaw_{}, ballistic_pitch_{};
double ballistic_yaw_step_{}, ballistic_pitch_step_{};
double deploy_pitch_{}, deploy_yaw_;
uint8_t last_shoot_freq_{};
double scale_{};
};
} // namespace rm_manual
17 changes: 12 additions & 5 deletions include/rm_manual/manual_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <iostream>
#include <ros/ros.h>
#include <unordered_map>
#include <std_msgs/Float32MultiArray.h>
#include <serial/serial.h>
#include <std_msgs/Bool.h>
#include <tf2_ros/buffer.h>
Expand Down Expand Up @@ -98,6 +99,12 @@ class ManualBase
virtual void shootDataCallback(const rm_msgs::ShootData::ConstPtr& data)
{
}
virtual void ballisticSolutionCallback(const std_msgs::Float32MultiArray::ConstPtr& data)
{
}
virtual void protectStateCallback(const std_msgs::Bool::ConstPtr& data)
{
}

// EtherCAT
virtual void ecatReconnected()
Expand Down Expand Up @@ -157,7 +164,8 @@ class ManualBase

ros::Subscriber ecat_bus_state_sub_, odom_sub_, dbus_sub_, track_sub_, referee_sub_, capacity_sub_, game_status_sub_,
joint_state_sub_, game_robot_hp_sub_, actuator_state_sub_, power_heat_data_sub_, gimbal_des_error_sub_,
game_robot_status_sub_, suggest_fire_sub_, shoot_beforehand_cmd_sub_, shoot_data_sub_;
game_robot_status_sub_, suggest_fire_sub_, shoot_beforehand_cmd_sub_, shoot_data_sub_, ballistic_solution_sub_,
protect_state_sub_;

sensor_msgs::JointState joint_state_;
rm_msgs::TrackData track_data_;
Expand All @@ -171,11 +179,10 @@ class ManualBase
ros::NodeHandle nh_;

ros::Time referee_last_get_stamp_;
bool remote_is_open_{ false }, referee_is_online_ = false;
bool ecat_bus_is_online_{ true };
bool remote_is_open_{ false }, referee_is_online_{ false }, ecat_bus_is_online_{ true };
int state_ = PASSIVE;
int robot_id_, chassis_power_;
int chassis_output_on_ = 0, gimbal_output_on_ = 0, shooter_output_on_ = 0;
int robot_id_{}, chassis_power_{};
int chassis_output_on_{}, gimbal_output_on_{}, shooter_output_on_{};
InputEvent robot_hp_event_, right_switch_down_event_, right_switch_mid_event_, right_switch_up_event_,
left_switch_down_event_, left_switch_mid_event_, left_switch_up_event_, ecat_reconnected_event_;

Expand Down
15 changes: 1 addition & 14 deletions src/balance_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,7 @@ void BalanceManual::sendCommand(const ros::Time& time)
chassis_cmd_sender_->getMsg()->follow_source_frame = reverse_frame_;
else
chassis_cmd_sender_->getMsg()->follow_source_frame = "yaw";

if (supply_)
{
cover_close_ = false;
cover_command_sender_->on();
}
else
{
cover_close_ = true;
cover_command_sender_->off();
}

ChassisGimbalShooterManual::sendCommand(time);
cover_command_sender_->sendCommand(time);
rm_manual::ChassisGimbalShooterCoverManual::sendCommand(time);
}

void BalanceManual::checkKeyboard(const rm_msgs::DbusData::ConstPtr& dbus_data)
Expand Down
5 changes: 0 additions & 5 deletions src/chassis_gimbal_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,6 @@ void ChassisGimbalManual::setChassisMode(int mode)
is_gyro_ = true;
vel_cmd_sender_->setAngularZVel(0.0);
break;
case rm_msgs::ChassisCmd::FALLEN:
chassis_cmd_sender_->setMode(rm_msgs::ChassisCmd::FALLEN);
is_gyro_ = false;
vel_cmd_sender_->setAngularZVel(0.0);
break;
}
}

Expand Down
Loading
Loading