Skip to content

Commit

Permalink
FIX: gravity computation using the robot state
Browse files Browse the repository at this point in the history
  • Loading branch information
falfab committed Mar 25, 2022
1 parent cac09ea commit 248c544
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## 0.9.0 - 2022-04-24
## 0.9.0 - UNRELEASED

Requires Panda system version >= 4.2.1

Expand Down
13 changes: 10 additions & 3 deletions include/franka/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,20 @@ class Model {
*
* @param[in] robot_state State from which the gravity vector should be calculated.
* @param[in] gravity_earth Earth's gravity vector. Unit: \f$\frac{m}{s^2}\f$.
* Default to {0.0, 0.0, -9.81}.
*
* @return Gravity vector.
*/
std::array<double, 7> gravity(const franka::RobotState& robot_state,
const std::array<double, 3>& gravity_earth = {
{0., 0., -9.81}}) const noexcept;
const std::array<double, 3>& gravity_earth) const noexcept;

/**
* Calculates the gravity vector using the robot state. Unit: \f$[Nm]\f$.
*
* @param[in] robot_state State from which the gravity vector should be calculated.
*
* @return Gravity vector.
*/
std::array<double, 7> gravity(const franka::RobotState& robot_state) const noexcept;

/// @cond DO_NOT_DOCUMENT
Model(const Model&) = delete;
Expand Down
4 changes: 4 additions & 0 deletions src/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ std::array<double, 7> franka::Model::gravity(const franka::RobotState& robot_sta
return gravity(robot_state.q, robot_state.m_total, robot_state.F_x_Ctotal, gravity_earth);
};

std::array<double, 7> franka::Model::gravity(const franka::RobotState& robot_state) const noexcept {
return gravity(robot_state, robot_state.O_ddP_O);
};

std::array<double, 7> franka::Model::gravity(
const std::array<double, 7>& q,
double m_total,
Expand Down

0 comments on commit 248c544

Please sign in to comment.