fix(arm): track power command results and sync 206 device templates
Initialize arm power state to false and update it only after successful arm-level enable or disable commands. Preserve Lingkong drive feedback diagnostics and add focused MuJoCo regression tests. Sync deployment templates from device 206, remove 209-specific neck/left-hand entries, and keep all 40 device entries disabled in version control. Preserve deployed runtime switches separately.
This commit is contained in:
parent
c2720956af
commit
2a5ef98649
@ -17,7 +17,7 @@ arm {
|
||||
tool_frame: "tool0"
|
||||
username: "aubo"
|
||||
password: "123456"
|
||||
auto_enable: false
|
||||
auto_enable: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
31
cmvr-es/config/devices/arm/lingkong_mixed_arm.pb.txt
Normal file
31
cmvr-es/config/devices/arm/lingkong_mixed_arm.pb.txt
Normal file
@ -0,0 +1,31 @@
|
||||
# Three-axis joint-only group. MoveJ positions follow joint_names order (rad).
|
||||
# CAN commands are sent per axis; this is not hardware-triggered synchronization.
|
||||
arm {
|
||||
robot_arms {
|
||||
id: "lingkong_mixed_arm"
|
||||
motor {
|
||||
motor_system_id: "lingkong_mixed_motors"
|
||||
motor_group_ids: "lingkong_mixed_v236"
|
||||
motor_group_ids: "lingkong_mixed_v238"
|
||||
dof: 3
|
||||
joint_names: "LINGKONG_MIXED_AXIS_1"
|
||||
joint_names: "LINGKONG_MIXED_AXIS_2"
|
||||
joint_names: "LINGKONG_MIXED_AXIS_3"
|
||||
upd_freq: 50
|
||||
}
|
||||
motion {
|
||||
joint_trajectory_smoother {
|
||||
sample_period_s: 0.02
|
||||
quintic_bspline {
|
||||
control_point_spacing_rad: 0.1
|
||||
}
|
||||
}
|
||||
move_j {
|
||||
settle_timeout_s: 2.0
|
||||
settle_position_tolerance_rad: 0.002
|
||||
settle_velocity_tolerance_rad_s: 0.02
|
||||
settle_stable_sample_count: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
# Independent joint-only neck; joint order follows motor IDs 1, 2, 3.
|
||||
arm {
|
||||
robot_arms {
|
||||
id: "neck_arm"
|
||||
motor {
|
||||
motor_system_id: "neck_can_motors"
|
||||
motor_group_ids: "neck_v236"
|
||||
motor_group_ids: "neck_v238"
|
||||
dof: 3
|
||||
joint_names: "neck_joint_1"
|
||||
joint_names: "neck_joint_2"
|
||||
joint_names: "neck_joint_3"
|
||||
upd_freq: 50
|
||||
}
|
||||
motion {
|
||||
joint_trajectory_smoother {
|
||||
sample_period_s: 0.02
|
||||
quintic_bspline { control_point_spacing_rad: 0.1 }
|
||||
}
|
||||
move_j {
|
||||
settle_timeout_s: 2.0
|
||||
settle_position_tolerance_rad: 0.002
|
||||
settle_velocity_tolerance_rad_s: 0.02
|
||||
settle_stable_sample_count: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,7 @@ dexhand {
|
||||
model: "ROH-LiteS001"
|
||||
has_tactile_feedback: false
|
||||
oymotion_ap001 {
|
||||
can_interface: "b5d2can0"
|
||||
can_interface: "can0"
|
||||
hand_id: 2
|
||||
master_id: 1
|
||||
command_timeout_ms: 255
|
||||
@ -81,15 +81,4 @@ dexhand {
|
||||
has_tactile_feedback: true
|
||||
zero_sim_touch {}
|
||||
}
|
||||
dexhands {
|
||||
id: "left_hand_lites001"
|
||||
model: "ROH-LiteS001"
|
||||
has_tactile_feedback: false
|
||||
oymotion_ap001 {
|
||||
can_interface: "b5d2can1"
|
||||
hand_id: 2
|
||||
master_id: 1
|
||||
command_timeout_ms: 255
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
62
cmvr-es/config/devices/motor/lingkong_mixed_motors.pb.txt
Normal file
62
cmvr-es/config/devices/motor/lingkong_mixed_motors.pb.txt
Normal file
@ -0,0 +1,62 @@
|
||||
# Alternative deployment: do not enable together with the original can3 IDs 1/2/3.
|
||||
# Both groups are loaded by the MotorConfig.id below, with unique motor IDs.
|
||||
motor {
|
||||
id: "lingkong_mixed_motors"
|
||||
motor_groups {
|
||||
id: "lingkong_mixed_v236"
|
||||
bus_type: MOTOR_BUS_CAN
|
||||
vendor: MOTOR_VENDOR_LINGKONG
|
||||
protocol: MOTOR_PROTOCOL_LINGKONG_CAN
|
||||
can { channel_id: 3 }
|
||||
motors {
|
||||
motors {
|
||||
id: 1
|
||||
joint_name: "LINGKONG_MIXED_AXIS_1"
|
||||
gear_ratio: 10
|
||||
limit_q_lb: -3.14
|
||||
limit_q_ub: 3.14
|
||||
limit_qd: 10
|
||||
lingkong {
|
||||
response_timeout_ms: 100
|
||||
reached_position_tolerance_rad: 0.001
|
||||
# Iq conversion intentionally unspecified until confirmed for this motor.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
motor_groups {
|
||||
id: "lingkong_mixed_v238"
|
||||
bus_type: MOTOR_BUS_CAN
|
||||
vendor: MOTOR_VENDOR_LINGKONG
|
||||
protocol: MOTOR_PROTOCOL_LINGKONG_CAN_V2_38
|
||||
can { channel_id: 3 }
|
||||
motors {
|
||||
motors {
|
||||
id: 2
|
||||
joint_name: "LINGKONG_MIXED_AXIS_2"
|
||||
gear_ratio: 10
|
||||
limit_q_lb: -3.14
|
||||
limit_q_ub: 3.14
|
||||
limit_qd: 10
|
||||
lingkong {
|
||||
response_timeout_ms: 100
|
||||
reached_position_tolerance_rad: 0.001
|
||||
# Iq conversion intentionally unspecified until confirmed for this motor.
|
||||
}
|
||||
}
|
||||
motors {
|
||||
id: 3
|
||||
joint_name: "LINGKONG_MIXED_AXIS_3"
|
||||
gear_ratio: 10
|
||||
limit_q_lb: -3.14
|
||||
limit_q_ub: 3.14
|
||||
limit_qd: 10
|
||||
lingkong {
|
||||
response_timeout_ms: 100
|
||||
reached_position_tolerance_rad: 0.001
|
||||
# Iq conversion intentionally unspecified until confirmed for this motor.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
# Neck: CAN2, ID1 V2.36; ID2/3 V2.38. Output shaft units: rad, rad/s.
|
||||
motor {
|
||||
id: "neck_can_motors"
|
||||
motor_groups {
|
||||
id: "neck_v236"
|
||||
bus_type: MOTOR_BUS_CAN
|
||||
vendor: MOTOR_VENDOR_LINGKONG
|
||||
protocol: MOTOR_PROTOCOL_LINGKONG_CAN
|
||||
can { channel_id: 2 }
|
||||
motors {
|
||||
motors {
|
||||
id: 1
|
||||
joint_name: "neck_joint_1"
|
||||
gear_ratio: 10
|
||||
limit_q_lb: -3.14
|
||||
limit_q_ub: 3.14
|
||||
limit_qd: 10
|
||||
lingkong { response_timeout_ms: 100 reached_position_tolerance_rad: 0.001 }
|
||||
}
|
||||
}
|
||||
}
|
||||
motor_groups {
|
||||
id: "neck_v238"
|
||||
bus_type: MOTOR_BUS_CAN
|
||||
vendor: MOTOR_VENDOR_LINGKONG
|
||||
protocol: MOTOR_PROTOCOL_LINGKONG_CAN_V2_38
|
||||
can { channel_id: 2 }
|
||||
motors {
|
||||
motors {
|
||||
id: 2
|
||||
joint_name: "neck_joint_2"
|
||||
gear_ratio: 10
|
||||
limit_q_lb: -3.14
|
||||
limit_q_ub: 3.14
|
||||
limit_qd: 10
|
||||
lingkong { response_timeout_ms: 100 reached_position_tolerance_rad: 0.001 }
|
||||
}
|
||||
motors {
|
||||
id: 3
|
||||
joint_name: "neck_joint_3"
|
||||
gear_ratio: 10
|
||||
limit_q_lb: -3.14
|
||||
limit_q_ub: 3.14
|
||||
limit_qd: 10
|
||||
lingkong { response_timeout_ms: 100 reached_position_tolerance_rad: 0.001 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,6 +66,13 @@ device_manager {
|
||||
enable: false
|
||||
}
|
||||
|
||||
devices {
|
||||
id: "right_hand_lites001"
|
||||
type: DEVICE_TYPE_DEXHAND
|
||||
config_file: "devices/dexhand/dexhand.pb.txt"
|
||||
enable: false
|
||||
}
|
||||
|
||||
devices {
|
||||
id: "hand2"
|
||||
type: DEVICE_TYPE_DEXHAND
|
||||
@ -207,23 +214,23 @@ device_manager {
|
||||
}
|
||||
|
||||
devices {
|
||||
id: "dual_arm_ethercat_motors"
|
||||
id: "tchl_dual_arm_motors"
|
||||
type: DEVICE_TYPE_MOTOR_SYSTEM
|
||||
config_file: "devices/motor/dual_arm_ethercat_motors.pb.txt"
|
||||
config_file: "devices/motor/tchl_dual_arm_motors.pb.txt"
|
||||
enable: false
|
||||
}
|
||||
|
||||
devices {
|
||||
id: "right_ethercat_arm"
|
||||
id: "right_tchl_arm"
|
||||
type: DEVICE_TYPE_ROBOT_ARM
|
||||
config_file: "devices/arm/ethercat_single_arm.pb.txt"
|
||||
config_file: "devices/arm/tchl_dual_arm.pb.txt"
|
||||
enable: false
|
||||
}
|
||||
|
||||
devices {
|
||||
id: "left_ethercat_arm"
|
||||
id: "left_tchl_arm"
|
||||
type: DEVICE_TYPE_ROBOT_ARM
|
||||
config_file: "devices/arm/ethercat_dual_arm.pb.txt"
|
||||
config_file: "devices/arm/tchl_dual_arm.pb.txt"
|
||||
enable: false
|
||||
}
|
||||
|
||||
@ -258,47 +265,17 @@ device_manager {
|
||||
enable: false
|
||||
}
|
||||
|
||||
|
||||
# Alternative hardware deployment; enable only on the matching device.
|
||||
devices {
|
||||
id: "tchl_dual_arm_motors"
|
||||
id: "lingkong_mixed_motors"
|
||||
type: DEVICE_TYPE_MOTOR_SYSTEM
|
||||
config_file: "devices/motor/tchl_dual_arm_motors.pb.txt"
|
||||
enable: true
|
||||
config_file: "devices/motor/lingkong_mixed_motors.pb.txt"
|
||||
enable: false
|
||||
}
|
||||
devices {
|
||||
id: "right_tchl_arm"
|
||||
id: "lingkong_mixed_arm"
|
||||
type: DEVICE_TYPE_ROBOT_ARM
|
||||
config_file: "devices/arm/tchl_dual_arm.pb.txt"
|
||||
enable: true
|
||||
}
|
||||
devices {
|
||||
id: "left_tchl_arm"
|
||||
type: DEVICE_TYPE_ROBOT_ARM
|
||||
config_file: "devices/arm/tchl_dual_arm.pb.txt"
|
||||
enable: true
|
||||
}
|
||||
devices {
|
||||
id: "right_hand_lites001"
|
||||
type: DEVICE_TYPE_DEXHAND
|
||||
config_file: "devices/dexhand/dexhand.pb.txt"
|
||||
enable: true
|
||||
}
|
||||
devices {
|
||||
id: "left_hand_lites001"
|
||||
type: DEVICE_TYPE_DEXHAND
|
||||
config_file: "devices/dexhand/dexhand.pb.txt"
|
||||
enable: true
|
||||
}
|
||||
devices {
|
||||
id: "neck_can_motors"
|
||||
type: DEVICE_TYPE_MOTOR_SYSTEM
|
||||
config_file: "devices/motor/neck_motors.pb.txt"
|
||||
enable: true
|
||||
}
|
||||
devices {
|
||||
id: "neck_arm"
|
||||
type: DEVICE_TYPE_ROBOT_ARM
|
||||
config_file: "devices/arm/neck_arm.pb.txt"
|
||||
enable: true
|
||||
config_file: "devices/arm/lingkong_mixed_arm.pb.txt"
|
||||
enable: false
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,18 +44,6 @@ quic_edge {
|
||||
# }
|
||||
# }
|
||||
|
||||
platforms {
|
||||
id: "platform_199"
|
||||
server_host: "192.168.0.199"
|
||||
server_port: 4433
|
||||
enable_media: false
|
||||
tls {
|
||||
ca_file: "certs/cmvr-quic-ca.crt"
|
||||
server_name: "192.168.0.199"
|
||||
allow_insecure: false
|
||||
}
|
||||
}
|
||||
|
||||
reconnect {
|
||||
initial_delay_ms: 500
|
||||
maximum_delay_ms: 30000
|
||||
|
||||
@ -177,6 +177,8 @@ private:
|
||||
int move_j_stable_sample_count_{3};
|
||||
|
||||
mutable std::mutex mutex_;
|
||||
// Last successful arm-level enable/disable result; not live drive feedback.
|
||||
std::atomic<bool> powered_on_{false};
|
||||
std::atomic<bool> busy_{false};
|
||||
std::atomic<std::uint64_t> joint_motion_stop_generation_{0};
|
||||
std::atomic<double> speed_scaling_{1.0};
|
||||
|
||||
@ -163,8 +163,8 @@ ArmState MotorRobotArm::getRobotState() const
|
||||
const bool emergency_stopped = emergency_stopped_.load();
|
||||
ArmState state;
|
||||
state.connected = motor_manager_ != nullptr;
|
||||
state.powered_on = true;
|
||||
state.brake_released = !emergency_stopped;
|
||||
state.powered_on = powered_on_.load();
|
||||
state.brake_released = powered_on_.load() && !emergency_stopped;
|
||||
state.moving = busy();
|
||||
state.protective_stopped = protective_stopped;
|
||||
state.emergency_stopped = emergency_stopped;
|
||||
@ -272,6 +272,7 @@ Result MotorRobotArm::torqueOn()
|
||||
}
|
||||
}
|
||||
emergency_stopped_.store(false);
|
||||
powered_on_.store(true);
|
||||
return Result::success();
|
||||
}
|
||||
|
||||
@ -287,6 +288,7 @@ Result MotorRobotArm::torqueOff()
|
||||
"failed to torque off motor for joint: " + joint_name);
|
||||
}
|
||||
}
|
||||
powered_on_.store(false);
|
||||
return Result::success();
|
||||
}
|
||||
|
||||
|
||||
@ -869,3 +869,29 @@ TEST_F(MotorRobotArmGen2MujocoTest, SpeedL)
|
||||
|
||||
} // namespace
|
||||
} // namespace cmvr::device
|
||||
|
||||
namespace cmvr::device {
|
||||
namespace {
|
||||
TEST(MotorRobotArmPowerState, StartsDisabledAndFailedEnableStaysDisabled) {
|
||||
config::RobotArmConfig cfg;
|
||||
cfg.set_id("uninitialized_power_test");
|
||||
cfg.mutable_motor()->set_motor_system_id("missing_power_test");
|
||||
cfg.mutable_motor()->set_dof(1);
|
||||
cfg.mutable_motor()->add_joint_names("missing_joint");
|
||||
MotorRobotArm arm(cfg);
|
||||
EXPECT_FALSE(arm.getRobotState().powered_on);
|
||||
EXPECT_FALSE(arm.torqueOn().ok());
|
||||
EXPECT_FALSE(arm.getRobotState().powered_on);
|
||||
}
|
||||
TEST_F(MotorRobotArmGen2MujocoTest, PowerStateTracksSuccessfulCommands) {
|
||||
EXPECT_TRUE(arm_->getRobotState().powered_on);
|
||||
const auto off = arm_->torqueOff();
|
||||
ASSERT_TRUE(off.ok()) << off.message;
|
||||
EXPECT_FALSE(arm_->getRobotState().powered_on);
|
||||
const auto on = arm_->torqueOn();
|
||||
ASSERT_TRUE(on.ok()) << on.message;
|
||||
EXPECT_TRUE(arm_->getRobotState().powered_on);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace cmvr::device
|
||||
|
||||
Loading…
Reference in New Issue
Block a user