From 30f71e7ae7cae0164038fd4df42a8084e80dccf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 8 Mar 2024 16:26:48 +0100 Subject: [PATCH 1/3] Set default servo temperature and voltage in sim --- vulp/actuation/BulletInterface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vulp/actuation/BulletInterface.cpp b/vulp/actuation/BulletInterface.cpp index e0ca0dc7..e27709eb 100644 --- a/vulp/actuation/BulletInterface.cpp +++ b/vulp/actuation/BulletInterface.cpp @@ -56,6 +56,8 @@ BulletInterface::BulletInterface(const ServoLayout& layout, const std::string& joint_name = id_joint.second; moteus::ServoReply reply; reply.id = servo_id; + reply.result.temperature = 20.0; // ['C], simulation room temperature + reply.result.voltage = 18.0; // [V], nominal voltage of a RYOBI battery joint_index_map_.try_emplace(joint_name, -1); servo_reply_.try_emplace(joint_name, reply); } From d569cd63ada8d70033b6bcd435368c0a96ae628d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 8 Mar 2024 16:28:48 +0100 Subject: [PATCH 2/3] Update the changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94576a29..f93d299a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- BulletInterface: Set a default servo temperature of 20 °C +- BulletInterface: Set a default servo voltage of 18 V + ## [2.2.1] - 2024-02-20 ### Added From 38001ed38b4845c8a9625d2cf30a3d81d700349b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 8 Mar 2024 16:37:45 +0100 Subject: [PATCH 3/3] Add unit tests for temperature and voltage --- vulp/actuation/tests/BulletInterfaceTest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vulp/actuation/tests/BulletInterfaceTest.cpp b/vulp/actuation/tests/BulletInterfaceTest.cpp index 538ce63d..38acdfba 100644 --- a/vulp/actuation/tests/BulletInterfaceTest.cpp +++ b/vulp/actuation/tests/BulletInterfaceTest.cpp @@ -220,4 +220,22 @@ TEST_F(BulletInterfaceTest, ComputeJointFeedforwardTorque) { ASSERT_NEAR(right_wheel_reply.result.torque, 0.42, 1e-3); } +TEST_F(BulletInterfaceTest, JointRepliesHaveTemperature) { + interface_->cycle(data_, [](const moteus::Output& output) {}); + for (const auto& pair : interface_->servo_reply()) { + const auto& reply = pair.second; + ASSERT_GT(reply.result.temperature, 0.0); + ASSERT_LT(reply.result.temperature, 100.0); + } +} + +TEST_F(BulletInterfaceTest, JointRepliesHaveVoltage) { + interface_->cycle(data_, [](const moteus::Output& output) {}); + for (const auto& pair : interface_->servo_reply()) { + const auto& reply = pair.second; + ASSERT_GT(reply.result.voltage, 10.0); // moteus min 10 V + ASSERT_LT(reply.result.voltage, 44.0); // moteus max 44 V + } +} + } // namespace vulp::actuation