Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
JafarAbdi committed Mar 29, 2021
1 parent c25bd50 commit 72fcfde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class PlanarJointModel : public JointModel
* @param[in] from A vector representing the initial position [x0, y0, theta0]
* @param[in] to A vector representing the target position [x1, y1, theta1]
* @param[in] min_translational_distance If the translational distance between \p from and \p to is less than this
* value the motion will be pure rotation
* value the motion will be pure rotation (meters)
* @param[out] dx x1 - x0 (meters)
* @param[out] dy y1 - y0 (meters)
* @param[out] initial_turn The initial turn in radians to face the target
Expand Down
18 changes: 9 additions & 9 deletions moveit_core/robot_model/src/planar_joint_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void computeTurnDriveTurnGeometry(const double* from, const double* to, const do
{
dx = to[0] - from[0];
dy = to[1] - from[1];
// If the translational distance between from & to states is very small, it will cause an unnecessary rotations since
// If the translational distance between from & to states is very small, it will cause an unnecessary rotation since
// the robot will try to do the following rather than rotating directly to the orientation of `to` state
// 1- Align itself with the line connecting the origin of both states
// 2- Move to the origin of `to` state
Expand Down Expand Up @@ -218,27 +218,27 @@ void PlanarJointModel::interpolate(const double* from, const double* to, const d
double drive_frac = drive_d / total_d;
double final_frac = final_d / total_d;

double pct;
double percent;
if (t <= initial_frac)
{
pct = t / initial_frac;
percent = t / initial_frac;
state[0] = from[0];
state[1] = from[1];
state[2] = from[2] + initial_turn * pct;
state[2] = from[2] + initial_turn * percent;
}
else if (t <= initial_frac + drive_frac)
{
pct = (t - initial_frac) / drive_frac;
state[0] = from[0] + dx * pct;
state[1] = from[1] + dy * pct;
percent = (t - initial_frac) / drive_frac;
state[0] = from[0] + dx * percent;
state[1] = from[1] + dy * percent;
state[2] = drive_angle;
}
else
{
pct = (t - initial_frac - drive_frac) / final_frac;
percent = (t - initial_frac - drive_frac) / final_frac;
state[0] = to[0];
state[1] = to[1];
state[2] = drive_angle + final_turn * pct;
state[2] = drive_angle + final_turn * percent;
}
}
}
Expand Down

0 comments on commit 72fcfde

Please sign in to comment.