Skip to content

Commit c01ae96

Browse files
committed
review fixes
1 parent 3f72282 commit c01ae96

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

bullet-featherstone/src/JointFeatures.cc

+19-7
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,14 @@ double JointFeatures::GetJointForce(
8484
const auto *joint = this->ReferenceInterface<JointInfo>(_id);
8585
const auto *identifier = std::get_if<InternalJoint>(&joint->identifier);
8686

87-
if (identifier) {
87+
if (identifier)
88+
{
8889
const auto *model = this->ReferenceInterface<ModelInfo>(joint->model);
8990
auto feedback = model->body->getLink(identifier->indexInBtModel).m_jointFeedback;
9091
const auto &link = model->body->getLink(identifier->indexInBtModel);
9192
results = 0.0;
92-
if (link.m_jointType == btMultibodyLink::eRevolute) {
93+
if (link.m_jointType == btMultibodyLink::eRevolute)
94+
{
9395
// According to the documentation in btMultibodyLink.h, m_axesTop[0] is the
9496
// joint axis for revolute joints.
9597
Eigen::Vector3d axis = convert(link.getAxisTop(0));
@@ -99,11 +101,16 @@ double JointFeatures::GetJointForce(
99101
angular.getX(),
100102
angular.getY(),
101103
angular.getZ());
102-
// BUG: The total force is 2 times the cmd one see:
103-
// https://github.com/bulletphysics/bullet3/discussions/3713
104104
results += axis_converted.Dot(angularTorque);
105-
return results / 2.0;
106-
} else if (link.m_jointType == btMultibodyLink::ePrismatic) {
105+
#if BT_BULLET_VERSION < 326
106+
// not always true
107+
return results / 2.0;
108+
#else
109+
return results;
110+
#endif
111+
}
112+
else if (link.m_jointType == btMultibodyLink::ePrismatic)
113+
{
107114
auto axis = convert(link.getAxisBottom(0));
108115
math::Vector3 axis_converted(axis[0], axis[1], axis[2]);
109116
btVector3 linear = feedback->m_reactionForces.getLinear();
@@ -112,7 +119,12 @@ double JointFeatures::GetJointForce(
112119
linear.getY(),
113120
linear.getZ());
114121
results += axis_converted.Dot(linearForce);
115-
return results / 2.0;
122+
#if BT_BULLET_VERSION < 326
123+
// not always true
124+
return results / 2.0;
125+
#else
126+
return results;
127+
#endif
116128
}
117129
}
118130
return results;

0 commit comments

Comments
 (0)