Skip to content

Commit

Permalink
[fix] compute shortest angular distance only on revolute joints
Browse files Browse the repository at this point in the history
  • Loading branch information
captain-yoshi committed Feb 22, 2024
1 parent c931acf commit 7c317b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/stages/connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,13 @@ void Connect::compute(const InterfaceState& from, const InterfaceState& to) {
Eigen::Map<const Eigen::VectorXd> positions_last_waypoint(
trajectory->getWayPoint(waypoint_count - 1).getJointPositions(jm), num);

double min_distance;
for (std::size_t i = 0; i < num; ++i) {
double min_distance = angles::shortest_angular_distance(positions_last_waypoint[i], positions_goal[i]);
if (jm->getType() == robot_state::JointModel::REVOLUTE)
min_distance = angles::shortest_angular_distance(positions_last_waypoint[i], positions_goal[i]);
else
min_distance = positions_last_waypoint[i], positions_goal[i];

ROS_DEBUG_STREAM_NAMED(
"Connect", "angular deviation: " << min_distance << " between trajectory last waypoint and goal.");

Expand Down

0 comments on commit 7c317b9

Please sign in to comment.