forked from zbw/yiliao2026
Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit. On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) Changes to be committed: modified: .gitignore modified: README.md new file: bashes/auto-wifi-connect.service new file: bashes/auto-wifi-connect.sh deleted: keyboard_control.py new file: my_model/image.png new file: path_follower_demo.py new file: scripts/PIDtracking.py new file: scripts/__pycache__/publish_sine_path.cpython-310.pyc new file: scripts/publish_sine_path.py modified: src/gc_navigation2_slamtoolbox/params/gc_navigation_slam.yaml modified: src/gc_navigation2_slamtoolbox/params/gc_navigation_slam.yaml.bak new file: src/gc_navigation2_slamtoolbox/params/gc_navigation_slam.yaml.bak2 modified: src/origincar_base/config/ekf.yaml new file: src/origincar_base/config/ekf.yaml.bak modified: src/origincar_base/launch/base_serial.launch.py new file: src/origincar_base/launch/base_serial.launch.py.bak modified: src/origincar_base/launch/origincar_bringup.launch.py new file: src/past_control/CMakeLists.txt new file: src/past_control/config/past_control.yaml new file: src/past_control/include/past_control/tools.h new file: src/past_control/launch/past_control.launch.py new file: src/past_control/msg/Obstacle.msg new file: src/past_control/msg/ObstacleArray.msg new file: src/past_control/package.xml new file: src/past_control/src/lane_follower_node.cpp new file: src/past_control/src/obstacle_detector_node.cpp new file: src/past_control/src/racing_orchestrator.cpp new file: src/planner/CMakeLists.txt new file: src/planner/config/planner.yaml new file: src/planner/launch/planner.launch.py new file: src/planner/package.xml new file: src/planner/src/planner_version.cpp modified: src/qr_detection/src/qr_dete_depth.cpp new file: src/racing_control/CMakeLists.txt new file: src/racing_control/include/racing_control/racing_control.hpp new file: src/racing_control/package.xml new file: src/racing_control/src/racing_control.cpp modified: src/vlm_detect/setup.py new file: src/vlm_detect/vlm_detect/__pycache__/__init__.cpython-310.pyc new file: src/vlm_detect/vlm_detect/__pycache__/tts_node.cpython-310.pyc new file: src/vlm_detect/vlm_detect/test_publisher.py new file: src/vlm_detect/vlm_detect/tts_node.py modified: src/vlm_detect/vlm_detect/vlm_node.py new file: tools/measure_turning_radius.py new file: tools/set_volume.py new file: tools/udp_to_cmdvel.py new file: tools/windows_keyboard_control.py new file: vlm_server.py new file: "\350\260\203\350\257\225\350\256\260\345\275\225.Assets/1.png" renamed: "\350\260\203\350\257\225\350\256\260\345\275\225.log" -> "\350\260\203\350\257\225\350\256\260\345\275\225.md"
This commit is contained in:
@@ -22,11 +22,13 @@ public:
|
||||
std::bind(&MinimalHbmemSubscriber::image_callback, this, std::placeholders::_1));
|
||||
|
||||
// 创建订阅器,订阅 'sign4return' 话题
|
||||
subscription_sign_ =
|
||||
this->create_subscription<std_msgs::msg::Int32>(
|
||||
"sign4return",
|
||||
10,
|
||||
std::bind(&MinimalHbmemSubscriber::sign_callback, this, std::placeholders::_1));
|
||||
// subscription_sign_ =
|
||||
// this->create_subscription<std_msgs::msg::Int32>(
|
||||
// "sign4return",
|
||||
// 10,
|
||||
// std::bind(&MinimalHbmemSubscriber::sign_callback, this, std::placeholders::_1));
|
||||
// 创建发布器,发布 'sign4return' 话题
|
||||
sign_publisher_ = this->create_publisher<std_msgs::msg::Int32>("sign4return", 10);
|
||||
|
||||
// 创建 publisher,topic 为 "qr_results"
|
||||
publisher_ =
|
||||
@@ -87,6 +89,23 @@ private:
|
||||
symbol->get_type_name().c_str(), symbol->get_data().c_str());
|
||||
}
|
||||
qr_results_buff_ = qr_results; // 更新缓存
|
||||
|
||||
// 检测字符合法性
|
||||
// if (ResultLegal(qr_results)){
|
||||
// // 发布sign4return话题
|
||||
// auto message = std_msgs::msg::Int32();
|
||||
// message.data = 5; // 5表示检测到二维码
|
||||
// sign_publisher_->publish(message);
|
||||
// RCLCPP_INFO(this->get_logger(), "QR Results Legal");
|
||||
// }
|
||||
// else{
|
||||
// RCLCPP_INFO(this->get_logger(), "\033[31m QR Results Illegal \033[00m");
|
||||
// }
|
||||
|
||||
// 发布sign4return话题
|
||||
auto message = std_msgs::msg::Int32();
|
||||
message.data = 5; // 5表示检测到二维码
|
||||
sign_publisher_->publish(message);
|
||||
} else {
|
||||
qr_results = "QR Code not detected";
|
||||
RCLCPP_INFO(this->get_logger(), "QR Code not detected");
|
||||
@@ -104,24 +123,36 @@ private:
|
||||
}
|
||||
|
||||
// 消息回调函数,处理 sign4return 话题
|
||||
void sign_callback(const std_msgs::msg::Int32::SharedPtr msg)
|
||||
{
|
||||
if (msg->data == 0)
|
||||
{
|
||||
detect_qr_code_ = true; // 启动二维码检测
|
||||
RCLCPP_INFO(this->get_logger(), "QR detection started");
|
||||
}
|
||||
else if (msg->data == 5)
|
||||
{
|
||||
detect_qr_code_ = false; // 停止二维码检测
|
||||
RCLCPP_INFO(this->get_logger(), "QR detection stopped");
|
||||
}
|
||||
// void sign_callback(const std_msgs::msg::Int32::SharedPtr msg)
|
||||
// {
|
||||
// if (msg->data == 0)
|
||||
// {
|
||||
// detect_qr_code_ = true; // 启动二维码检测
|
||||
// RCLCPP_INFO(this->get_logger(), "QR detection started");
|
||||
// }
|
||||
// else if (msg->data == 5)
|
||||
// {
|
||||
// detect_qr_code_ = false; // 停止二维码检测
|
||||
// RCLCPP_INFO(this->get_logger(), "QR detection stopped");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 识别结果合法性检测
|
||||
bool ResultLegal(std::string& input){
|
||||
// 合法字符串集合
|
||||
static const std::unordered_set<std::string> kValidStrings = {
|
||||
"1", "2", "顺时针", "逆时针", "顺", "逆"
|
||||
};
|
||||
return kValidStrings.find(input) != kValidStrings.end();
|
||||
}
|
||||
|
||||
|
||||
// /aurora/rgb/image_raw 订阅器
|
||||
rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr subscription_image_;
|
||||
// sign4return 订阅器
|
||||
rclcpp::Subscription<std_msgs::msg::Int32>::SharedPtr subscription_sign_;
|
||||
// rclcpp::Subscription<std_msgs::msg::Int32>::SharedPtr subscription_sign_;
|
||||
// sign4return 发布器
|
||||
rclcpp::Publisher<std_msgs::msg::Int32>::SharedPtr sign_publisher_;
|
||||
// QR code results 发布器
|
||||
rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user