Skip to content

Commit

Permalink
urdf_model: don't use or define M_PI (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters authored Oct 26, 2017
1 parent 995aa1e commit ed597eb
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions urdf_model/include/urdf_model/pose.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@
#ifndef URDF_INTERFACE_POSE_H
#define URDF_INTERFACE_POSE_H

//For using the M_PI macro in visual studio it
//is necessary to define _USE_MATH_DEFINES
#ifdef _MSC_VER
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#endif

#include <cmath>
#include <sstream>
#include <stdexcept>
Expand Down Expand Up @@ -126,12 +118,13 @@ class Rotation

// Cases derived from https://orbitalstation.wordpress.com/tag/quaternion/
double sarg = -2 * (this->x*this->z - this->w*this->y);
const double pi_2 = 1.57079632679489661923;
if (sarg <= -0.99999) {
pitch = -0.5*M_PI;
pitch = -pi_2;
roll = 0;
yaw = 2 * atan2(this->x, -this->y);
} else if (sarg >= 0.99999) {
pitch = 0.5*M_PI;
pitch = pi_2;
roll = 0;
yaw = 2 * atan2(-this->x, this->y);
} else {
Expand Down

0 comments on commit ed597eb

Please sign in to comment.