feat(agv_pro_base): add power_on status detection, update version from 1.0.2 to 1.0.3

This commit is contained in:
X-lanni
2025-07-03 17:46:25 +08:00
parent 51bd10a875
commit ffa37ff262
3 changed files with 165 additions and 44 deletions
@@ -14,8 +14,6 @@
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#define RECEIVE_DATA_SIZE 14 //The length of the data sent by the esp32
#define SEND_DATA_SIZE 14 //The length of data sent by ROS to the esp32
#define RETURN_COMMAND 0x25
extern std::array<double, 36> odom_pose_covariance;
extern std::array<double, 36> odom_twist_covariance;
@@ -27,11 +25,16 @@ public:
~AGV_PRO();
private:
void Control();
void print_hex(const std::string& label, const std::vector<uint8_t>& data, std::optional<size_t> override_size = std::nullopt);
void send_serial_frame(const std::vector<uint8_t>& frame, bool debug);
void is_power_on();
void set_auto_report();
bool readData();
void publisherOdom(double dt);
void publisherVoltage();
void cmdCallback(const geometry_msgs::msg::Twist::SharedPtr msg);
std::vector<uint8_t> build_serial_frame(uint8_t cmd_id, const std::vector<uint8_t>& payload);
std::vector<uint8_t> read_serial_response(const std::vector<uint8_t>& expected_header, size_t payload_size, double timeout_sec);
std::string frame_id_of_odometry_;
std::string child_frame_id_of_odometry_;
@@ -51,6 +54,9 @@ private:
double linearY = 0.0;
double angularZ = 0.0;
int is_poweron_status = 0;
int poweron_status = 0;
uint8_t motor_status = 0;
uint8_t motor_error = 0;
uint8_t enable_status = 0;