Skip to content

Commit

Permalink
utils.h and geometry.h can be used standalone, added db tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rdiankov committed Feb 11, 2012
1 parent e2332fb commit 65d6ba8
Show file tree
Hide file tree
Showing 17 changed files with 210 additions and 602 deletions.
4 changes: 2 additions & 2 deletions docs/en/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
ChangeLog
#########

Version 0.6.3 Unstable
======================
Version 0.6.3 Development
=========================

Subversion Revision: **Unreleased**

Expand Down
8 changes: 5 additions & 3 deletions include/openrave/geometry.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2006-2011 Rosen Diankov <rosen.diankov@gmail.com>
// Copyright (C) 2006-2012 Rosen Diankov <rosen.diankov@gmail.com>
//
// This file is part of OpenRAVE.
// OpenRAVE is free software: you can redistribute it and/or modify
Expand All @@ -16,15 +16,17 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/** \file geometry.h
\brief Basic gemoetric primitives and affine math functions on them.
This file can be used stand-alone without \ref openrave.h .
*/
#ifndef OPENRAVE_GEOMETRY_H
#define OPENRAVE_GEOMETRY_H

#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <limits>
#include <utility> // for std::pair
#include <cstring>
#include <cstdlib>

#ifndef RAVE_DEPRECATED
Expand Down
2 changes: 1 addition & 1 deletion include/openrave/openrave.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ typedef float dReal;
#endif

/// \brief openrave constant for PI, could be replaced by accurate precision number depending on choice of dReal.
static const dReal PI = (dReal)3.14159265358979323846;
static const dReal PI = dReal(3.14159265358979323846);

/// Wrappers of common basic math functions, allows OpenRAVE to control the precision requirements.
/// \ingroup affine_math
Expand Down
28 changes: 19 additions & 9 deletions include/openrave/utils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2006-2011 Rosen Diankov <rosen.diankov@gmail.com>
// Copyright (C) 2006-2012 Rosen Diankov <rosen.diankov@gmail.com>
//
// This file is part of OpenRAVE.
// OpenRAVE is free software: you can redistribute it and/or modify
Expand All @@ -18,17 +18,25 @@
/** \file utils.h
\brief Programming related utilities likes tokenizers, timers, name checkers, etc.
This file is optional and not automatically included with \ref openrave.h
This file is optional and not automatically included with \ref openrave.h . Furthermore, it can be used stand-alone without \ref openrave.h .
*/
#ifndef OPENRAVE_UTILS_H
#define OPENRAVE_UTILS_H

#include <openrave/openrave.h>
#include <openrave/config.h>
#include <stdint.h>
#include <string>
#include <istream>
#include <vector>

#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/function.hpp>

#include <time.h>

#ifndef _WIN32
#if POSIX_TIMERS <= 0 && _POSIX_TIMERS <= 0
#if !(defined(CLOCK_GETTIME_FOUND) && (POSIX_TIMERS > 0 || _POSIX_TIMERS > 0))
#include <sys/time.h>
#endif
#else
Expand Down Expand Up @@ -256,15 +264,17 @@ template <typename T>
inline T NormalizeCircularAngle(T theta, T min, T max)
{
if (theta < min) {
theta += T(2*PI);
T range = max-min;
theta += range;
while (theta < min) {
theta += T(2*PI);
theta += range;
}
}
else if (theta > max) {
theta -= T(2*PI);
T range = max-min;
theta -= range;
while (theta > max) {
theta -= T(2*PI);
theta -= range;
}
}
return theta;
Expand All @@ -273,6 +283,7 @@ inline T NormalizeCircularAngle(T theta, T min, T max)
template <typename T>
inline T SubtractCircularAngle(T f0, T f1)
{
const T PI = T(3.14159265358979323846);
return NormalizeCircularAngle(f0-f1, T(-PI), T(PI));
}

Expand Down Expand Up @@ -312,7 +323,6 @@ inline std::string ConvertToOpenRAVEName(const std::string& name)
newname[i] = '_';
}
}
RAVELOG_WARN(boost::str(boost::format("name '%s' is not a valid OpenRAVE name, converting to '%s'")%name%newname));
return newname;
}

Expand Down
4 changes: 2 additions & 2 deletions openrave_completion.bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function _complete_openravepy {
if [[ $COMP_CWORD == 2 ]]; then
case ${COMP_WORDS[1]} in
--listinterfaces)
opts="planner robot sensorsystem controller probleminstance inversekinematicssolver kinbody physicsengine sensor collisionchecker trajectory viewer spacesampler"
opts="planner robot sensorsystem controller module inversekinematicssolver kinbody physicsengine sensor collisionchecker trajectory viewer spacesampler"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
Expand Down Expand Up @@ -128,7 +128,7 @@ function _complete_openrave_robotpy {
function _complete_openrave_createpluginpy {
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--usecore --planner --robot --sensorsystem --controller --probleminstance --iksolver --kinbody --physicsengine --sensor --collisionchecker --trajectory --viewer --spacesampler --help"
opts="--usecore --planner --robot --sensorsystem --controller --module --iksolver --kinbody --physicsengine --sensor --collisionchecker --trajectory --viewer --spacesampler --help"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
}
complete -F "_complete_openravepy" -o filenames -o plusdirs "openrave.py"
Expand Down
Loading

0 comments on commit 65d6ba8

Please sign in to comment.