mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-22 20:19:43 +00:00
temperature can be list, average in such case
This commit is contained in:
@@ -52,12 +52,14 @@ def lowstate_to_dict(msg: hg_LowState) -> dict[str, Any]:
|
|||||||
"""Convert LowState SDK message to a JSON-serializable dictionary."""
|
"""Convert LowState SDK message to a JSON-serializable dictionary."""
|
||||||
motor_states = []
|
motor_states = []
|
||||||
for i in range(NUM_MOTORS):
|
for i in range(NUM_MOTORS):
|
||||||
|
temp = msg.motor_state[i].temperature
|
||||||
|
avg_temp = float(sum(temp) / len(temp)) if isinstance(temp, list) else float(temp)
|
||||||
motor_states.append(
|
motor_states.append(
|
||||||
{
|
{
|
||||||
"q": float(msg.motor_state[i].q),
|
"q": float(msg.motor_state[i].q),
|
||||||
"dq": float(msg.motor_state[i].dq),
|
"dq": float(msg.motor_state[i].dq),
|
||||||
"tau_est": float(msg.motor_state[i].tau_est),
|
"tau_est": float(msg.motor_state[i].tau_est),
|
||||||
"temperature": float(msg.motor_state[i].temperature),
|
"temperature": avg_temp,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user