fix gimbal

This commit is contained in:
Robofish 2026-03-03 12:12:01 +08:00
parent 91f29de5f4
commit bd1f9f742c
8 changed files with 23 additions and 19 deletions

View File

@ -35,7 +35,7 @@ add_executable(calibrate_handeye calibration/calibrate_handeye.cpp)
add_executable(calibrate_robotworld_handeye calibration/calibrate_robotworld_handeye.cpp) add_executable(calibrate_robotworld_handeye calibration/calibrate_robotworld_handeye.cpp)
add_executable(split_video calibration/split_video.cpp) add_executable(split_video calibration/split_video.cpp)
target_link_libraries(capture ${OpenCV_LIBS} fmt::fmt component device) target_link_libraries(capture ${OpenCV_LIBS} fmt::fmt yaml-cpp component device)
target_link_libraries(calibrate_camera ${OpenCV_LIBS} fmt::fmt yaml-cpp component) target_link_libraries(calibrate_camera ${OpenCV_LIBS} fmt::fmt yaml-cpp component)
target_link_libraries(calibrate_handeye ${OpenCV_LIBS} fmt::fmt yaml-cpp component) target_link_libraries(calibrate_handeye ${OpenCV_LIBS} fmt::fmt yaml-cpp component)
target_link_libraries(calibrate_robotworld_handeye ${OpenCV_LIBS} fmt::fmt yaml-cpp component) target_link_libraries(calibrate_robotworld_handeye ${OpenCV_LIBS} fmt::fmt yaml-cpp component)
@ -117,4 +117,3 @@ target_link_libraries(balance_infantry ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann
add_executable(balance_infantry_mpc src/task/balance_infantry_mpc.cpp) add_executable(balance_infantry_mpc src/task/balance_infantry_mpc.cpp)
target_link_libraries(balance_infantry_mpc ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device) target_link_libraries(balance_infantry_mpc ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device)

View File

@ -76,7 +76,7 @@ can_interface: "can0"
#####-----gimbal参数-----##### #####-----gimbal参数-----#####
com_port: "/dev/gimbal" com_port: "/dev/gimbal"
baudrate: 115200
#####-----buff_detector参数-----##### #####-----buff_detector参数-----#####
model: "assets/yolo11_buff_int8.xml" model: "assets/yolo11_buff_int8.xml"

View File

@ -1,7 +1,7 @@
pattern_cols: 10 pattern_cols: 11
pattern_rows: 7 pattern_rows: 8
center_distance_mm: 40 center_distance_mm: 30
pattern_type: circles_grid # circles_grid | chessboard pattern_type: chessboard # circles_grid | chessboard
R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1] R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1]
@ -15,3 +15,6 @@ quaternion_canid: 0x01
bullet_speed_canid: 0x110 bullet_speed_canid: 0x110
send_canid: 0xff send_canid: 0xff
can_interface: "can0" can_interface: "can0"
#####-----gimbal参数-----#####
com_port: "/dev/ttyUSB0"
baudrate: 115200

View File

@ -1,9 +1,9 @@
camera_name: "mindvision" # camera_name: "mindvision"
exposure_ms: 2 # exposure_ms: 2
gamma: 0.5 # gamma: 0.5
vid_pid: "f622:d13a" # vid_pid: "f622:d13a"
# camera_name: "hikrobot" camera_name: "hikrobot"
# exposure_ms: 3 exposure_ms: 3
# gain: 10.0 gain: 10.0
# vid_pid: "2bdf:0001" vid_pid: "2bdf:0001"

View File

@ -78,7 +78,7 @@ can_interface: "can0"
#####-----gimbal参数-----##### #####-----gimbal参数-----#####
com_port: "/dev/gimbal" com_port: "/dev/gimbal"
baudrate: 115200
#####-----planner-----##### #####-----planner-----#####
fire_thresh: 0.003 fire_thresh: 0.003

View File

@ -79,6 +79,7 @@ can_interface: "can0"
#####-----gimbal参数-----##### #####-----gimbal参数-----#####
com_port: "/dev/ttyUSB0" com_port: "/dev/ttyUSB0"
baudrate: 115200
yaw_kp: 0 yaw_kp: 0
yaw_kd: 0 yaw_kd: 0
pitch_kp: 0 pitch_kp: 0

View File

@ -79,7 +79,7 @@ can_interface: "can0"
#####-----gimbal参数-----##### #####-----gimbal参数-----#####
com_port: "/dev/gimbal" com_port: "/dev/gimbal"
baudrate: 115200
#####-----planner-----##### #####-----planner-----#####
fire_thresh: 0.003 fire_thresh: 0.003

View File

@ -11,13 +11,14 @@ Gimbal::Gimbal(const std::string & config_path)
{ {
auto yaml = component::load(config_path); auto yaml = component::load(config_path);
auto com_port = component::read<std::string>(yaml, "com_port"); auto com_port = component::read<std::string>(yaml, "com_port");
auto baudrate = component::read<int>(yaml, "baudrate");
try { try {
serial_.setPort(com_port); serial_.setPort(com_port);
serial_.setBaudrate(115200); serial_.setBaudrate(baudrate);
serial_.setTimeout(serial::Timeout::max(), 100, 0, 100, 0); serial_.setTimeout(serial::Timeout::max(), 100, 0, 100, 0);
serial_.open(); serial_.open();
component::logger()->info("[Gimbal] Serial port {} opened at 115200 baud", com_port); component::logger()->info("[Gimbal] Serial port {} opened at {} baud", com_port, baudrate);
} catch (const std::exception & e) { } catch (const std::exception & e) {
component::logger()->error("[Gimbal] Failed to open serial: {}", e.what()); component::logger()->error("[Gimbal] Failed to open serial: {}", e.what());
exit(1); exit(1);