Compare commits
3 Commits
b4c795f77d
...
输出pid改进版
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f5ced6be3 | |||
| 601e248cd6 | |||
| 93935889e0 |
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/tracking.hpp>
|
||||
|
||||
@@ -30,13 +30,13 @@ void output_control_data(const cv::Point2f* ballistic_point,
|
||||
std::ostringstream send_str;
|
||||
|
||||
// Calculate offset (based on actual image center)
|
||||
int ballistic_offset_x = -static_cast<int>(ballistic_point->x - img_center.x);
|
||||
if ( abs(ballistic_offset_x) > 320){
|
||||
ballistic_offset_x = ( ballistic_offset_x / abs( ballistic_offset_x ) ) * 320 ;
|
||||
int ballistic_offset_yaw = 1.9*-static_cast<int>(ballistic_point->x - img_center.x);
|
||||
if ( abs(ballistic_offset_yaw) > 320){
|
||||
ballistic_offset_yaw = ( ballistic_offset_yaw / abs( ballistic_offset_yaw ) ) * 220 ;
|
||||
}
|
||||
int ballistic_offset_y = -static_cast<int>(img_center.y - ballistic_point->y);
|
||||
if ( abs(ballistic_offset_y) > 180 ) {
|
||||
ballistic_offset_y = ( ballistic_offset_x / abs( ballistic_offset_x ) ) * 180 ;
|
||||
int ballistic_offset_pitch = 1.9*-static_cast<int>(img_center.y - ballistic_point->y);
|
||||
if ( abs(ballistic_offset_pitch) > 180 ) {
|
||||
ballistic_offset_pitch = ( ballistic_offset_pitch / abs( ballistic_offset_pitch ) ) * 180*1.9 ;
|
||||
}
|
||||
|
||||
// Color simplification mapping
|
||||
@@ -45,7 +45,7 @@ void output_control_data(const cv::Point2f* ballistic_point,
|
||||
else if (target_color == "blue") simplified_color = "b";
|
||||
|
||||
// Construct send string (original format)
|
||||
send_str << "#s " << simplified_color << " " << std::to_string(ballistic_offset_x) << " " << std::to_string(ballistic_offset_y) << "*\n";
|
||||
send_str << "#s " << simplified_color << " " << std::to_string(ballistic_offset_yaw) << " " << std::to_string(ballistic_offset_pitch) << "*\n";
|
||||
|
||||
// Send data
|
||||
if (ttl_communicator != nullptr) {
|
||||
@@ -298,9 +298,9 @@ int main(int /*argc*/, char* /*argv*/[]) {
|
||||
output_control_data(display_center, target_color, ttl, img_center, use_ttl);
|
||||
|
||||
// Display windows
|
||||
cv::imshow("Armor Detection", frame);
|
||||
cv::imshow(target_color + " Mask", mask);
|
||||
cv::imshow(target_color + " Only", color_only_frame);
|
||||
cv::imshow("Armor Detection", frame);
|
||||
|
||||
// Exit on 'q' key press
|
||||
if (cv::waitKey(1) == 'q') {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -1,2 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
Reference in New Issue
Block a user