Skip to content

Commit

Permalink
Assign a value of 0 to init_pos to prevent memory allocation errors o…
Browse files Browse the repository at this point in the history
…n different machines
  • Loading branch information
craipy-hub committed Nov 30, 2024
1 parent 01ead90 commit 390c6f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion example/g1/high_level/g1_arm5_sdk_dds_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ int main(int argc, char const *argv[]) {
auto sleep_time =
std::chrono::milliseconds(static_cast<int>(control_dt / 0.001f));

std::array<float, 13> init_pos{};
std::array<float, 13> init_pos{0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0};

std::array<float, 13> target_pos = {0.f, kPi_2, 0.f, kPi_2, 0.f,
0.f, -kPi_2, 0.f, kPi_2, 0.f,
Expand Down
4 changes: 3 additions & 1 deletion example/g1/high_level/g1_arm7_sdk_dds_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ int main(int argc, char const *argv[]) {
auto sleep_time =
std::chrono::milliseconds(static_cast<int>(control_dt / 0.001f));

std::array<float, 17> init_pos{};
std::array<float, 17> init_pos{0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0};

std::array<float, 17> target_pos = {0.f, kPi_2, 0.f, kPi_2, 0.f, 0.f, 0.f,
0.f, -kPi_2, 0.f, kPi_2, 0.f, 0.f, 0.f,
Expand Down
4 changes: 3 additions & 1 deletion example/h1/high_level/h1_arm_sdk_dds_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ int main(int argc, char const *argv[]) {
auto sleep_time =
std::chrono::milliseconds(static_cast<int>(control_dt / 0.001f));

std::array<float, 9> init_pos{};
std::array<float, 9> init_pos{0, 0, 0, 0,
0, 0, 0, 0,
0};

std::array<float, 9> target_pos = {0.f, kPi_2, 0.f, kPi_2,
0.f, -kPi_2, 0.f, kPi_2,
Expand Down

0 comments on commit 390c6f3

Please sign in to comment.