屏蔽算法运行时冗余日志
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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(); // 使用新方法
|
||||
|
||||
|
||||
@@ -886,11 +886,6 @@ void QuadrupedRobotSimulation::CalculateMotorData()
|
||||
int phase_RF = static_cast<int>(timeRF * n_frames);
|
||||
int phase_RH = static_cast<int>(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();
|
||||
|
||||
|
||||
@@ -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<double> &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"(<joint\s+name=\"([^\"]+)\")");
|
||||
std::regex childLinkRegex(R"(<child\s+link=\"([^\"]+)\"\s+uuid=\"([^\"]+)\")");
|
||||
@@ -471,9 +450,6 @@ bool Robot::parseJointChildLinkUuidsFromUrdf(const std::string &urdfString)
|
||||
std::string uuid = childMatches[2].str();
|
||||
jointChildLinkUuidMap[jointName] = uuid;
|
||||
|
||||
std::cout << "Found joint: " << jointName
|
||||
<< " -> 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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user