Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/Pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Pose Pose::inverse() const {
}

bool Pose::is_close(const Pose &other, double eps_r, double eps_t) const {
return (this->translation() - other.translation()).norm() < eps_t &&
return (this->translation() - other.translation()).lpNorm<1>() < eps_t &&
this->quaternion().angularDistance(other.quaternion()) < eps_r;
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/Pose.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct RPY {
}

bool is_close(const RPY &other, double eps = 1e-8) const {
return this->as_vector().isApprox(other.as_vector(), eps);
return (this->as_vector() - other.as_vector()).lpNorm<1>() < eps;
}
};

Expand Down
11 changes: 7 additions & 4 deletions src/sim/FR3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,18 @@ void FR3::set_cartesian_position(const common::Pose& pose) {
}
void FR3::is_moving_callback() {
common::Vector7d current_angles = this->get_joint_position();
this->state.is_moving = not this->state.previous_angles.isApprox(
current_angles, 0.0001); // TODO: careful with isapprox
// difference of the largest element is smaller than threshold
this->state.is_moving =
(current_angles - this->state.previous_angles).cwiseAbs().maxCoeff() >
0.0001;
this->state.previous_angles = current_angles;
}

void FR3::is_arrived_callback() {
common::Vector7d current_angles = this->get_joint_position();
this->state.is_arrived = this->state.target_angles.isApprox(
current_angles, this->cfg.joint_rotational_tolerance);
this->state.is_arrived =
(current_angles - this->state.target_angles).cwiseAbs().maxCoeff() <
this->cfg.joint_rotational_tolerance;
}

bool FR3::collision_callback() {
Expand Down