From 77ad559900143178b38decc58ac9ee39c9ad6e2e Mon Sep 17 00:00:00 2001 From: matheecs Date: Thu, 26 Dec 2024 14:47:19 +0800 Subject: [PATCH] change imu info at g1 torso --- example/g1/low_level/g1_ankle_swing_example.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/example/g1/low_level/g1_ankle_swing_example.cpp b/example/g1/low_level/g1_ankle_swing_example.cpp index 5d12df2..759aedf 100644 --- a/example/g1/low_level/g1_ankle_swing_example.cpp +++ b/example/g1/low_level/g1_ankle_swing_example.cpp @@ -10,19 +10,18 @@ #include // IDL +#include #include #include -#include #include static const std::string HG_CMD_TOPIC = "rt/lowcmd"; -static const std::string HG_IMU_TORSO = "rt/lowstate_doubleimu"; +static const std::string HG_IMU_TORSO = "rt/secondary_imu"; static const std::string HG_STATE_TOPIC = "rt/lowstate"; using namespace unitree::common; using namespace unitree::robot; using namespace unitree_hg::msg::dds_; -using namespace unitree_hg_doubleimu::msg::dds_; template class DataBuffer { @@ -165,7 +164,7 @@ class G1Example { ChannelPublisherPtr lowcmd_publisher_; ChannelSubscriberPtr lowstate_subscriber_; - ChannelSubscriberPtr imutorso_subscriber_; + ChannelSubscriberPtr imutorso_subscriber_; ThreadPtr command_writer_ptr_, control_thread_ptr_; std::shared_ptr msc_; @@ -197,7 +196,7 @@ class G1Example { // create subscriber lowstate_subscriber_.reset(new ChannelSubscriber(HG_STATE_TOPIC)); lowstate_subscriber_->InitChannel(std::bind(&G1Example::LowStateHandler, this, std::placeholders::_1), 1); - imutorso_subscriber_.reset(new ChannelSubscriber(HG_IMU_TORSO)); + imutorso_subscriber_.reset(new ChannelSubscriber(HG_IMU_TORSO)); imutorso_subscriber_->InitChannel(std::bind(&G1Example::imuTorsoHandler, this, std::placeholders::_1), 1); // create threads command_writer_ptr_ = CreateRecurrentThreadEx("command_writer", UT_CPU_ID_NONE, 2000, &G1Example::LowCommandWriter, this); @@ -205,7 +204,7 @@ class G1Example { } void imuTorsoHandler(const void *message) { - doubleIMUState_ imu_torso = *(const doubleIMUState_ *)message; + IMUState_ imu_torso = *(const IMUState_ *)message; auto &rpy = imu_torso.rpy(); if (counter_ % 500 == 0) printf("IMU.torso.rpy: %.2f %.2f %.2f\n", rpy[0], rpy[1], rpy[2]);