Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "jsk_footstep_planner/transition_limit.h"
00037 #include <pcl/common/eigen.h>
00038
00039 namespace jsk_footstep_planner
00040 {
00041 TransitionLimitRP::TransitionLimitRP(
00042 double roll_max,
00043 double pitch_max):
00044 roll_max_(roll_max), pitch_max_(pitch_max)
00045 {
00046 }
00047
00048 bool TransitionLimitRP::check(FootstepState::Ptr from,
00049 FootstepState::Ptr to) const
00050 {
00051 const Eigen::Affine3f diff = to->getPose() * from->getPose().inverse();
00052 float roll, pitch, yaw;
00053 pcl::getEulerAngles(diff, roll, pitch, yaw);
00054 return (std::abs(roll) < roll_max_ &&
00055 std::abs(pitch) < pitch_max_);
00056 }
00057
00058 TransitionLimitXYZRPY::TransitionLimitXYZRPY(
00059 double x_max,
00060 double y_max,
00061 double z_max,
00062 double roll_max,
00063 double pitch_max,
00064 double yaw_max):
00065 x_max_(x_max), y_max_(y_max), z_max_(z_max),
00066 roll_max_(roll_max), pitch_max_(pitch_max), yaw_max_(yaw_max)
00067 {
00068 }
00069
00070 bool TransitionLimitXYZRPY::check(FootstepState::Ptr from,
00071 FootstepState::Ptr to) const
00072 {
00073
00074 const Eigen::Affine3f diff = to->getPose() * from->getPose().inverse();
00075 const Eigen::Vector3f diff_pos(diff.translation());
00076 if (std::abs(diff_pos[0]) < x_max_ &&
00077 std::abs(diff_pos[1]) < y_max_ &&
00078 std::abs(diff_pos[2]) < z_max_) {
00079 float roll, pitch, yaw;
00080 pcl::getEulerAngles(diff, roll, pitch, yaw);
00081 return (std::abs(roll) < roll_max_ &&
00082 std::abs(pitch) < pitch_max_ &&
00083 std::abs(yaw) < yaw_max_);
00084 }
00085 else {
00086 return false;
00087 }
00088 }
00089 }