19 hardware_interface::EffortJointInterface>
29 bool init(hardware_interface::RobotHW* robot_hw, ros::NodeHandle& root_nh, ros::NodeHandle& controller_nh)
override;
32 void moveJoint(
const ros::Time& time,
const ros::Duration& period)
override;
33 void normal(
const ros::Time& time,
const ros::Duration& period);
34 void block(
const ros::Time& time,
const ros::Duration& period);
35 geometry_msgs::Twist odometry()
override;
36 static const int STATE_DIM = 10;
37 static const int CONTROL_DIM = 4;
38 Eigen::Matrix<double, CONTROL_DIM, STATE_DIM> k_{};
39 Eigen::Matrix<double, STATE_DIM, STATE_DIM> a_{}, q_{};
40 Eigen::Matrix<double, STATE_DIM, CONTROL_DIM> b_{};
41 Eigen::Matrix<double, CONTROL_DIM, CONTROL_DIM> r_{};
42 Eigen::Matrix<double, STATE_DIM, 1> x_;
43 double wheel_radius_, wheel_base_;
44 double position_des_ = 0;
45 double position_offset_ = 0.;
46 double position_clear_threshold_ = 0.;
50 ros::Time block_time_, last_block_time_;
51 double block_angle_, block_duration_, block_velocity_, block_effort_, anti_block_effort_, block_overtime_;
52 bool balance_state_changed_ =
false, maybe_block_ =
false;
54 hardware_interface::ImuSensorHandle imu_handle_;
55 hardware_interface::JointHandle left_wheel_joint_handle_, right_wheel_joint_handle_,
56 left_momentum_block_joint_handle_, right_momentum_block_joint_handle_;
58 typedef std::shared_ptr<realtime_tools::RealtimePublisher<rm_msgs::BalanceState>> RtpublisherPtr;
59 RtpublisherPtr state_pub_;
60 geometry_msgs::Vector3 angular_vel_base_;
61 double roll_, pitch_, yaw_;