12 #include "gmock/gmock.h" 13 #include "gtest/gtest.h" 18 auto& hipModel = actuatorModels[1];
21 hipModel.setFriction(
false);
23 double tauMaxPositive = 0, tauMaxNegative = 0;
24 double maxQdMaxTorque = 0, qdMax = 0;
27 for (
double tau = 0; tau < 200; tau += .1) {
28 double tauAct = hipModel.getTorque(tau, 0);
29 if (!
fpEqual(tau, tauAct, .0001)) {
30 tauMaxPositive = tauAct;
35 for (
double tau = 0; tau > -200; tau -= .1) {
36 double tauAct = hipModel.getTorque(tau, 0);
37 if (!
fpEqual(tau, tauAct, .0001)) {
38 tauMaxNegative = tauAct;
43 for (
double qd = 0; qd < 40; qd += .01) {
44 double tauAct = hipModel.getTorque(18, qd);
45 if (!
fpEqual(18., tauAct, .0001)) {
51 for (
double qd = 0; qd < 60; qd += .01) {
52 double tauAct = hipModel.getTorque(18, qd);
59 EXPECT_TRUE(
fpEqual(tauMaxPositive, 18., .0001));
60 EXPECT_TRUE(
fpEqual(tauMaxNegative, -18., .0001));
61 EXPECT_TRUE(
fpEqual(maxQdMaxTorque, 28.47, .02));
62 EXPECT_TRUE(
fpEqual(qdMax, 40., .0001));
68 auto& hipModel = actuatorModels[1];
71 hipModel.setFriction(
false);
73 double tauMaxPositive = 0, tauMaxNegative = 0;
74 double maxQdMaxTorque = 0, qdMax = 0;
77 for (
double tau = 0; tau < 300; tau += .1) {
78 double tauAct = hipModel.getTorque(tau, 0);
79 if (!
fpEqual(tau, tauAct, .0001)) {
80 tauMaxPositive = tauAct;
85 for (
double tau = 0; tau > -300; tau -= .1) {
86 double tauAct = hipModel.getTorque(tau, 0);
87 if (!
fpEqual(tau, tauAct, .0001)) {
88 tauMaxNegative = tauAct;
93 for (
double qd = 0; qd < 40; qd += .01) {
94 double tauAct = hipModel.getTorque(208, qd);
95 if (!
fpEqual(208., tauAct, .0001)) {
101 for (
double qd = 0; qd < 60; qd += .01) {
102 double tauAct = hipModel.getTorque(208, qd);
109 EXPECT_TRUE(
fpEqual(tauMaxPositive, 208.6, .1));
110 EXPECT_TRUE(
fpEqual(tauMaxNegative, -208.6, .1));
111 EXPECT_TRUE(
fpEqual(maxQdMaxTorque, 8.44, .02));
112 EXPECT_TRUE(
fpEqual(qdMax, 15.94, .1));
bool fpEqual(T a, T b, T tol)
Data structure containing parameters for quadruped robot.
Utility function to build a Cheetah 3 Quadruped object.
Utility function to build a Mini Cheetah Quadruped object.
TEST(ActuatorModel, miniCheetah)
std::vector< ActuatorModel< T > > buildActuatorModels()
Model of actuator Includes friction, max torque, and motor torque speed curve.