Skip to content

Commit

Permalink
[TorqueController] Pass qRefIn without checking range of motion when …
Browse files Browse the repository at this point in the history
…motor torque contorller is disabled
  • Loading branch information
Kohei Kimura committed Dec 25, 2015
1 parent 445c619 commit 65f20fb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rtc/TorqueController/TorqueController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,15 @@ RTC::ReturnCode_t TorqueController::onExecute(RTC::UniqueId ec_id)
// calculate dq by torque controller
executeTorqueControl(dq);

// output restricted qRef
// check range of motion and insert to output
for (int i = 0; i < m_robot->numJoints(); i++) {
m_qRefOut.data[i] = std::min(std::max(m_qRefIn.data[i] + dq[i], m_robot->joint(i)->llimit), m_robot->joint(i)->ulimit);
if (m_motorTorqueControllers[i].isEnabled()) {
m_qRefOut.data[i] = std::min(std::max(m_qRefIn.data[i] + dq[i], m_robot->joint(i)->llimit), m_robot->joint(i)->ulimit);
} else {
m_qRefOut.data[i] = m_qRefIn.data[i]; // pass joint angle when controller is disabled
}
}

} else {
if (isDebug()) {
std::cerr << "[" << m_profile.instance_name << "]" << "TorqueController input is not correct" << std::endl;
Expand Down

0 comments on commit 65f20fb

Please sign in to comment.