65class Controller :
public controller_interface::MultiInterfaceController<hardware_interface::EffortJointInterface,
66 rm_control::RobotStateInterface>
70 bool init(hardware_interface::RobotHW* robot_hw, ros::NodeHandle& root_nh, ros::NodeHandle& controller_nh)
override;
71 void update(
const ros::Time& time,
const ros::Duration& period)
override;
72 void starting(
const ros::Time& )
override;
75 void stop(
const ros::Time& time,
const ros::Duration& period);
76 void ready(
const ros::Duration& period);
77 void push(
const ros::Time& time,
const ros::Duration& period);
78 void block(
const ros::Time& time,
const ros::Duration& period);
79 void setSpeed(
const rm_msgs::ShootCmd& cmd);
81 void judgeBulletShoot(
const ros::Time& time,
const ros::Duration& period);
82 void commandCB(
const rm_msgs::ShootCmdConstPtr& msg)
84 cmd_rt_buffer_.writeFromNonRT(*msg);
87 void reconfigCB(rm_shooter_controllers::ShooterConfig& config, uint32_t );
89 hardware_interface::EffortJointInterface* effort_joint_interface_{};
90 std::vector<std::vector<effort_controllers::JointVelocityController*>> ctrls_friction_;
91 effort_controllers::JointPositionController ctrl_trigger_;
92 std::vector<std::vector<double>> wheel_speed_offsets_;
93 std::vector<std::vector<double>> wheel_speed_directions_;
94 LowPassFilter* lp_filter_;
95 int push_per_rotation_{}, count_{};
96 double push_wheel_speed_threshold_{};
97 double freq_threshold_{};
98 bool dynamic_reconfig_initialized_ =
false;
99 bool state_changed_ =
false;
100 bool enter_ready_ =
false;
101 bool maybe_block_ =
false;
102 int friction_block_count = 0;
103 bool last_friction_wheel_block =
false, friction_wheel_block =
false;
104 double friction_block_effort_{}, friction_block_vel_{};
105 double anti_friction_block_duty_cycle_{}, anti_friction_block_vel_{};
106 bool has_shoot_ =
false, has_shoot_last_ =
false;
107 bool wheel_speed_drop_ =
true;
108 double last_fricition_speed_{};
109 double last_friction_change_speed_{};
111 ros::Time last_shoot_time_, block_time_, last_block_time_;
121 realtime_tools::RealtimeBuffer<Config> config_rt_buffer;
122 realtime_tools::RealtimeBuffer<rm_msgs::ShootCmd> cmd_rt_buffer_;
123 rm_msgs::ShootCmd cmd_;
124 std::shared_ptr<realtime_tools::RealtimePublisher<rm_msgs::LocalHeatState>> local_heat_state_pub_;
125 std::shared_ptr<realtime_tools::RealtimePublisher<rm_msgs::ShootState>> shoot_state_pub_;
126 ros::Subscriber cmd_subscriber_;
127 dynamic_reconfigure::Server<rm_shooter_controllers::ShooterConfig>* d_srv_{};