mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 10:00:48 +02:00
Catch NaN error if angles are zero
This commit is contained in:
@@ -602,7 +602,11 @@ private:
|
|||||||
double ry = tool_vector_actual[4];
|
double ry = tool_vector_actual[4];
|
||||||
double rz = tool_vector_actual[5];
|
double rz = tool_vector_actual[5];
|
||||||
double angle = std::sqrt(std::pow(rx,2) + std::pow(ry,2) + std::pow(rz,2));
|
double angle = std::sqrt(std::pow(rx,2) + std::pow(ry,2) + std::pow(rz,2));
|
||||||
|
if (angle < 1e-16) {
|
||||||
|
quat.setValue(0, 0, 0, 1);
|
||||||
|
} else {
|
||||||
quat.setRotation(tf::Vector3(rx/angle, ry/angle, rz/angle), angle);
|
quat.setRotation(tf::Vector3(rx/angle, ry/angle, rz/angle), angle);
|
||||||
|
}
|
||||||
|
|
||||||
//Create and broadcast transform
|
//Create and broadcast transform
|
||||||
tf::Transform transform;
|
tf::Transform transform;
|
||||||
|
|||||||
Reference in New Issue
Block a user