From 12310de782b0b501065259252e21f086e50f8527 Mon Sep 17 00:00:00 2001
From: zhangshun <453905631@qq.com>
Date: Mon, 1 Jun 2026 17:38:29 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=B0=83=E8=AF=95=E9=A1=B5?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E6=A0=B7=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/index.html | 233 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 218 insertions(+), 15 deletions(-)
diff --git a/public/index.html b/public/index.html
index 575270d..f28a93e 100644
--- a/public/index.html
+++ b/public/index.html
@@ -123,6 +123,33 @@
margin-top: 16px;
}
+ .sample-bar {
+ display: grid;
+ gap: 10px;
+ margin-top: 16px;
+ padding: 14px;
+ border: 1px solid var(--line);
+ border-radius: 14px;
+ background: rgba(255, 255, 255, 0.72);
+ }
+
+ .sample-row {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+ align-items: center;
+ }
+
+ select {
+ width: 100%;
+ border: 1px solid var(--line);
+ border-radius: 12px;
+ padding: 11px 12px;
+ font-size: 14px;
+ color: var(--text);
+ background: #fff;
+ }
+
button {
border: 0;
border-radius: 12px;
@@ -268,10 +295,28 @@
"req_param": {}
}
+
+
+
+
+
+
+
+
+
+
-
@@ -321,11 +366,174 @@
const requestStatus = document.getElementById("request-status");
const requestBox = document.getElementById("request");
const output = document.getElementById("output");
+ const sampleSelect = document.getElementById("sample-select");
const metaSuccess = document.getElementById("meta-success");
const metaCode = document.getElementById("meta-code");
const metaCmd = document.getElementById("meta-cmd");
const metaReq = document.getElementById("meta-req");
+ const requestSamples = {
+ listRobots: {
+ msg: "list robots after init",
+ req_code: "CASE_LIST_001",
+ req_from: "local_debug",
+ req_cmd: "Cmd_ListRobots",
+ req_param: {
+ detail: true
+ }
+ },
+ kinematicsForwardZero: {
+ msg: "fk zero pose",
+ req_code: "CASE_FK_001",
+ req_from: "local_debug",
+ req_cmd: "Cmd_Kinematics_forward_pose_str",
+ req_param: {
+ robot_uuid: "abb_irb120_3_58",
+ q_init_str: "0,0,0,0,0,0"
+ }
+ },
+ kinematicsForwardAllJoints: {
+ msg: "fk all joints path",
+ req_code: "CASE_FK_ALL_001",
+ req_from: "local_debug",
+ req_cmd: "Cmd_Kinematics_forward_all_joints",
+ req_param: {
+ robot_uuid: "abb_irb120_3_58",
+ joints_str: "0,0,0,0,0,0;10,20,30,40,50,60"
+ }
+ },
+ spcBasic: {
+ msg: "spc basic 5x30",
+ req_code: "CASE_SPC_001",
+ req_from: "local_debug",
+ req_cmd: "Cmd_Spc",
+ req_param: {
+ n: 5,
+ k: 30,
+ usl: 1.7,
+ lsl: 1.5,
+ x: [
+ 1.55, 1.58, 1.61, 1.6, 1.6, 1.58, 1.63, 1.63, 1.62, 1.63,
+ 1.62, 1.63, 1.62, 1.59, 1.58, 1.58, 1.6, 1.61, 1.62, 1.63,
+ 1.58, 1.64, 1.63, 1.62, 1.62, 1.62, 1.62, 1.63, 1.61, 1.57,
+ 1.64, 1.62, 1.61, 1.6, 1.58, 1.57, 1.59, 1.61, 1.62, 1.63,
+ 1.58, 1.61, 1.6, 1.62, 1.63, 1.6, 1.61, 1.64, 1.64, 1.63,
+ 1.58, 1.6, 1.62, 1.63, 1.65, 1.62, 1.58, 1.59, 1.57, 1.58,
+ 1.57, 1.57, 1.58, 1.59, 1.64, 1.61, 1.64, 1.62, 1.6, 1.59,
+ 1.65, 1.62, 1.62, 1.6, 1.58, 1.57, 1.59, 1.57, 1.59, 1.62,
+ 1.56, 1.57, 1.57, 1.61, 1.62, 1.56, 1.58, 1.59, 1.6, 1.62,
+ 1.58, 1.6, 1.6, 1.62, 1.63, 1.58, 1.59, 1.6, 1.63, 1.62,
+ 1.58, 1.59, 1.62, 1.63, 1.64, 1.58, 1.59, 1.62, 1.63, 1.61,
+ 1.58, 1.59, 1.6, 1.61, 1.63, 1.57, 1.59, 1.61, 1.61, 1.62,
+ 1.58, 1.58, 1.6, 1.61, 1.63, 1.62, 1.58, 1.58, 1.58, 1.57,
+ 1.63, 1.59, 1.57, 1.58, 1.57, 1.58, 1.62, 1.61, 1.63, 1.61,
+ 1.58, 1.57, 1.59, 1.6, 1.62, 1.62, 1.6, 1.6, 1.57, 1.57
+ ]
+ }
+ },
+ fourBarValid: {
+ msg: "fourbar valid",
+ req_code: "CASE_FB_001",
+ req_from: "local_debug",
+ req_cmd: "Cmd_FourBar_CrankSlider",
+ req_param: {
+ L_AB: 0.5,
+ L_BS: 2.0,
+ S_OFS: 0.0,
+ angleDeg: 45.0
+ }
+ },
+ fourBarInvalid: {
+ msg: "fourbar invalid",
+ req_code: "CASE_FB_002",
+ req_from: "local_debug",
+ req_cmd: "Cmd_FourBar_CrankSlider",
+ req_param: {
+ L_AB: 0.0,
+ L_BS: 0.2,
+ S_OFS: 0.5,
+ angleDeg: 30.0
+ }
+ },
+ quadrupedPoints: {
+ msg: "quadruped points from motor angles",
+ req_code: "CASE_QP_001",
+ req_from: "local_debug",
+ req_cmd: "Cmd_QuadrupedRobot_CalculateAllPointsFromMotorAngles",
+ req_param: {
+ Param: {
+ LF: {
+ thigh_angle_deg: -37.4784578338516,
+ shank_angle_deg: -22.4917532451628,
+ ankle_angle_deg: 0.0
+ },
+ LH: {
+ thigh_angle_deg: -34.0564623655754,
+ shank_angle_deg: -22.1353106546916,
+ ankle_angle_deg: 0.0
+ },
+ RF: {
+ thigh_angle_deg: 34.0564623655754,
+ shank_angle_deg: 22.1353106546916,
+ ankle_angle_deg: 0.0
+ },
+ RH: {
+ thigh_angle_deg: 37.4784578338516,
+ shank_angle_deg: 22.4917532451628,
+ ankle_angle_deg: 0.0
+ }
+ }
+ }
+ },
+ quadrupedForwardGait: {
+ msg: "quadruped forward gait",
+ req_code: "CASE_QP_002",
+ req_from: "local_debug",
+ req_cmd: "Cmd_QuadrupedRobot_PerformForwardKinematics",
+ req_param: {
+ GaitInfo: {
+ GaitType: "trot",
+ Period: 0.8,
+ Frequency: 50.0,
+ StepTime: 0.02,
+ SupportTime: 0.4,
+ SwingTime: 0.4,
+ SupportRatio: 0.5,
+ SwingRatio: 0.5,
+ TotalFrames: 40,
+ TotalTime: 0.8
+ },
+ SystemParameters: {
+ A_x: 0.0,
+ A_y: 500.0,
+ L10: 300.0,
+ L20: 286.0,
+ L30: 55.0,
+ StepLength: 60.0,
+ StepHeight: 50.0,
+ X: 30.0,
+ DeltaX: 0.0,
+ L21: 70.0,
+ L22: 292.0,
+ L23: 80.0,
+ Beta1: 166.0,
+ BB2_BC_Angle: 3.3859387489,
+ C1_B_Length: 107.0,
+ CC1: 179.0,
+ L31: 32.0,
+ C2C3_Length: 32.0,
+ Lead: 10.0,
+ D1_L_Offset: 90.0,
+ D2_L_Offset: 50.0,
+ C4_D2_Offset: 18.0,
+ ThighMotorReduction: 1.0,
+ ShankMotorReduction: 1.0,
+ AnkleMotorReduction: 1.0
+ }
+ }
+ }
+ };
+
function escapeHtml(value) {
return value
.replaceAll("&", "&")
@@ -403,19 +611,13 @@
return ptr;
}
- function sampleFourBar() {
- requestBox.value = JSON.stringify({
- msg: "fourbar valid",
- req_code: "CASE_FB_001",
- req_from: "local_debug",
- req_cmd: "Cmd_FourBar_CrankSlider",
- req_param: {
- L_AB: 0.5,
- L_BS: 2.0,
- S_OFS: 0.0,
- angleDeg: 45.0
- }
- }, null, 2);
+ function loadSelectedSample() {
+ const selectedKey = sampleSelect.value;
+ const sample = requestSamples[selectedKey];
+ if (!sample) {
+ return;
+ }
+ requestBox.value = JSON.stringify(sample, null, 2);
}
async function ensureModule() {
@@ -481,7 +683,7 @@
document.getElementById("init-btn").addEventListener("click", initializeBusinessApi);
document.getElementById("run-btn").addEventListener("click", runRequest);
- document.getElementById("sample-btn").addEventListener("click", sampleFourBar);
+ document.getElementById("sample-btn").addEventListener("click", loadSelectedSample);
document.getElementById("clear-btn").addEventListener("click", () => {
requestStatus.textContent = "等待操作";
resetMeta();
@@ -489,6 +691,7 @@
});
resetMeta();
+ loadSelectedSample();