From 856a7250f2a029f2c764aef86a3b6ae0f4ecc4cb Mon Sep 17 00:00:00 2001 From: zhangshun <453905631@qq.com> Date: Tue, 16 Jun 2026 16:00:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E7=AE=97=E6=B3=95=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E5=86=97=E4=BD=99=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KinematicsHelper.cpp | 6 ---- .../KinematicsReverse.cpp | 10 ------- .../KinematicsSimulation.cpp | 5 ---- src/Robot.cpp | 30 ------------------- src/api/KinematicsWebAPI.Core.cpp | 2 -- .../KinematicsWebAPI.QuadrupedCommands.cpp | 2 -- 6 files changed, 55 deletions(-) diff --git a/src/QuadrupedRobotSimulation/KinematicsHelper.cpp b/src/QuadrupedRobotSimulation/KinematicsHelper.cpp index 0f61b0a..c901af3 100644 --- a/src/QuadrupedRobotSimulation/KinematicsHelper.cpp +++ b/src/QuadrupedRobotSimulation/KinematicsHelper.cpp @@ -84,9 +84,6 @@ void KinematicsHelper::SimRobot() json KinematicsHelper::QuadrupedRobot_CalculateAllPointsFromMotorAngles(const std::string &jsonInput) { - - std::cout << "[DEBUG] json KinematicsHelper::QuadrupedRobot_CalculateAllPointsFromMotorAngles(const std::string &jsonInput) " << std::endl; - std::string jsonStr = "{}"; auto manager = RobotGaitDataManagerFromJson(jsonInput); ReverseKinematicsCalculator simulation(manager); @@ -96,9 +93,6 @@ json KinematicsHelper::QuadrupedRobot_CalculateAllPointsFromMotorAngles(const st } json KinematicsHelper::QuadrupedRobot_PerformForwardKinematics(const std::string &jsonInput) { - - std::cout << "[DEBUG] json KinematicsHelper::QuadrupedRobot_PerformForwardKinematics(const std::string &jsonInput) " << std::endl; - auto manager = RobotGaitDataManagerFromJson(jsonInput); QuadrupedRobotConfiguration config(manager->GetGaitInfo(), manager->GetSystemParameters()); QuadrupedRobotSimulation simulation(config); diff --git a/src/QuadrupedRobotSimulation/KinematicsReverse.cpp b/src/QuadrupedRobotSimulation/KinematicsReverse.cpp index 758efcb..271d92d 100644 --- a/src/QuadrupedRobotSimulation/KinematicsReverse.cpp +++ b/src/QuadrupedRobotSimulation/KinematicsReverse.cpp @@ -972,8 +972,6 @@ std::string ReverseKinematicsCalculator::CalculateAllPointsFromMotorAnglesJsonSt if (paramDict.empty()) { - std::cout << "[DEBUG] 没有Param数据 json KinematicsHelper::QuadrupedRobot_CalculateAllPointsFromMotorAngles(const std::string &jsonInput) " << std::endl; - return "没有Param数据"; } // debugPrintParamDict(paramDict); @@ -991,14 +989,6 @@ std::string ReverseKinematicsCalculator::CalculateAllPointsFromMotorAnglesJsonSt auto points_dict = CalculateAllPointsFromMotorAnglesReverse( thigh_angle_deg, shank_angle_deg, ankle_angle_deg, leg_type); - // std::cout << "计算得到的点数量: " << points_dict.size() << "\n"; - // std::cout << "包含的点: "; - for (const auto &p : points_dict) - { - std::cout << p.first << " "; - } - // std::cout << "\n"; - // 改为: auto modelID = _manager->GetModelIDObject(); // 使用新方法 diff --git a/src/QuadrupedRobotSimulation/KinematicsSimulation.cpp b/src/QuadrupedRobotSimulation/KinematicsSimulation.cpp index c20fdb0..be958af 100644 --- a/src/QuadrupedRobotSimulation/KinematicsSimulation.cpp +++ b/src/QuadrupedRobotSimulation/KinematicsSimulation.cpp @@ -886,11 +886,6 @@ void QuadrupedRobotSimulation::CalculateMotorData() int phase_RF = static_cast(timeRF * n_frames); int phase_RH = static_cast(timeRH * n_frames); - std::cout << "步态类型: " << gait_type << std::endl; - std::cout << "总帧数: " << n_frames << std::endl; - std::cout << "相位偏移(帧): LF=0, LH=" << phase_LH - << ", RF=" << phase_RF << ", RH=" << phase_RH << std::endl; - // 1. 计算左前腿基准数据 motor_data_LF_raw = CalculateIncrementsAndVelocities(); diff --git a/src/Robot.cpp b/src/Robot.cpp index 46e0612..57f80e8 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -67,7 +67,6 @@ bool Robot::selectKinematicChain(const KDL::Tree &tree, KDL::Chain &selectedChai if (tree.getChain("base", "tool0", legacyChain) && legacyChain.getNrOfJoints() == 6) { selectedChain = legacyChain; - std::cout << "Selected kinematic chain by legacy names: base -> tool0" << std::endl; return true; } @@ -115,10 +114,6 @@ bool Robot::selectKinematicChain(const KDL::Tree &tree, KDL::Chain &selectedChai return false; } - std::cout << "Selected kinematic chain by inference: " << rootName - << " -> " << selectedTipName - << " (" << selectedChain.getNrOfJoints() << " joints, " - << selectedChain.getNrOfSegments() << " segments)" << std::endl; return true; } @@ -209,10 +204,6 @@ bool Robot::validateJointLimits(const double joints[6], const std::string &conte if (value < lower - tolerance || value > upper + tolerance) { - const std::string jointName = i < activeJointNames.size() ? activeJointNames[i] : ("joint_" + std::to_string(i + 1)); - std::cerr << context << " joint limit violation: " << jointName - << " value=" << value - << ", range=[" << lower << ", " << upper << "]" << std::endl; return false; } } @@ -225,7 +216,6 @@ bool Robot::validateJointLimits(const std::vector &joints, const std::st { if (joints.size() != 6) { - std::cerr << context << " joint count invalid: " << joints.size() << std::endl; return false; } @@ -292,8 +282,6 @@ bool Robot::initRobot(const std::string &urdfString) // LMA 求解器按调用时动态构造,便于传入不同收敛参数。 m_initialized = true; - std::cout << "Robot initialized successfully with " - << kinematicChain.getNrOfJoints() << " joints" << std::endl; numberOfJoints = getNumberOfJoints(); return true; } @@ -409,9 +397,6 @@ bool Robot::parseJointChildLinkUuidsFromUrdf(const std::string &urdfString) std::smatch matches; std::string::const_iterator searchStart(urdfString.cbegin()); - // 输出解析过程,便于排查 URDF 结构问题。 - std::cout << "Parsing URDF for joint child link UUIDs..." << std::endl; - bool foundAny = false; while (std::regex_search(searchStart, urdfString.cend(), matches, jointRegex)) { @@ -422,10 +407,6 @@ bool Robot::parseJointChildLinkUuidsFromUrdf(const std::string &urdfString) std::string uuid = matches[3].str(); jointChildLinkUuidMap[jointName] = uuid; - // 输出匹配结果。 - std::cout << "Found joint: " << jointName - << " -> Child link: " << childLinkName - << " -> UUID: " << uuid << std::endl; foundAny = true; } searchStart = matches.suffix().first; @@ -434,8 +415,6 @@ bool Robot::parseJointChildLinkUuidsFromUrdf(const std::string &urdfString) // 如果首轮没有命中,则退化为更宽松的解析方式。 if (!foundAny) { - std::cout << "Trying alternative parsing method..." << std::endl; - // 方案二:分别匹配 joint 名称和 child link。 std::regex jointNameRegex(R"( Child link: " << childLinkName - << " -> UUID: " << uuid << std::endl; foundAny = true; } } @@ -489,15 +465,9 @@ bool Robot::parseJointChildLinkUuidsFromUrdf(const std::string &urdfString) { std::cerr << "No joint child link UUIDs found in URDF" << std::endl; - // 仅打印前 500 个字符,避免日志过长。 - std::cout << "First 500 characters of URDF:" << std::endl; - std::cout << urdfString.substr(0, 500) << std::endl; - return false; } - std::cout << "Successfully parsed " << jointChildLinkUuidMap.size() - << " joint child link UUIDs" << std::endl; return true; } catch (const std::exception &e) diff --git a/src/api/KinematicsWebAPI.Core.cpp b/src/api/KinematicsWebAPI.Core.cpp index 1881935..ff73aee 100644 --- a/src/api/KinematicsWebAPI.Core.cpp +++ b/src/api/KinematicsWebAPI.Core.cpp @@ -150,8 +150,6 @@ json KinematicsWebAPI::createUnknownCommandResponse(const std::string &req_cmd, void KinematicsWebAPI::log(const std::string &message) { - std::cout << "[" << getCurrentTimestamp() << "] " << message << std::endl; - if (onLog) { onLog("[" + getCurrentTimestamp() + "] " + message); diff --git a/src/api/KinematicsWebAPI.QuadrupedCommands.cpp b/src/api/KinematicsWebAPI.QuadrupedCommands.cpp index 7552547..34419b8 100644 --- a/src/api/KinematicsWebAPI.QuadrupedCommands.cpp +++ b/src/api/KinematicsWebAPI.QuadrupedCommands.cpp @@ -7,13 +7,11 @@ json KinematicsWebAPI::handleQuadrupedCommand(const std::string &req_cmd, const { if (req_cmd == "Cmd_QuadrupedRobot_CalculateAllPointsFromMotorAngles") { - std::cout << "[DEBUG] Cmd_QuadrupedRobot_CalculateAllPointsFromMotorAngles: 开始计算点位" << std::endl; return KinematicsHelper::QuadrupedRobot_CalculateAllPointsFromMotorAngles(req_param.dump()); } if (req_cmd == "Cmd_QuadrupedRobot_PerformForwardKinematics") { - std::cout << "[DEBUG] Cmd_QuadrupedRobot_PerformForwardKinematics: 开始执行正运动学" << std::endl; return KinematicsHelper::QuadrupedRobot_PerformForwardKinematics(req_param.dump()); }