From 81fa87035a512f2eeaac079bd35a256ffef7d413 Mon Sep 17 00:00:00 2001 From: fan-ziqi Date: Sun, 28 Apr 2024 20:01:13 +0800 Subject: [PATCH] feat: don't autograd --- src/rl_sar/src/rl_real_a1.cpp | 2 ++ src/rl_sar/src/rl_real_cyberdog.cpp | 2 ++ src/rl_sar/src/rl_sim.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/rl_sar/src/rl_real_a1.cpp b/src/rl_sar/src/rl_real_a1.cpp index e0dd322..02129be 100644 --- a/src/rl_sar/src/rl_real_a1.cpp +++ b/src/rl_sar/src/rl_real_a1.cpp @@ -9,6 +9,8 @@ RL_Real rl_sar; RL_Real::RL_Real() : safe(LeggedType::A1), udp(LOWLEVEL) { + torch::autograd::GradMode::set_enabled(false); + ReadYaml(ROBOT_NAME); udp.InitCmdData(cmd); diff --git a/src/rl_sar/src/rl_real_cyberdog.cpp b/src/rl_sar/src/rl_real_cyberdog.cpp index 1097e41..65f7e76 100644 --- a/src/rl_sar/src/rl_real_cyberdog.cpp +++ b/src/rl_sar/src/rl_real_cyberdog.cpp @@ -9,6 +9,8 @@ RL_Real rl_sar; RL_Real::RL_Real() : CustomInterface(500) { + torch::autograd::GradMode::set_enabled(false); + ReadYaml(ROBOT_NAME); start_time = std::chrono::high_resolution_clock::now(); diff --git a/src/rl_sar/src/rl_sim.cpp b/src/rl_sar/src/rl_sim.cpp index 04e5318..58d094c 100644 --- a/src/rl_sar/src/rl_sim.cpp +++ b/src/rl_sar/src/rl_sim.cpp @@ -7,6 +7,8 @@ RL_Sim::RL_Sim() { + torch::autograd::GradMode::set_enabled(false); + ReadYaml(ROBOT_NAME); // Due to the fact that the robot_state_publisher sorts the joint names alphabetically,