Commit 839df5df authored by Olivier Stasse's avatar Olivier Stasse
Browse files

Fix a pb on size_t for Dim.

size_t is unsigned but not Eigen::Dynamics (which is set to -1)
This set Dim to the maximal value for a long unsigned int.
This generates overflow.
This commit fix this problem.
parent ca780364
Pipeline #3159 failed with stage
in 2 minutes and 49 seconds
......@@ -28,7 +28,7 @@ namespace spline
/// For degree lesser than 4, the evaluation is analitycal.Otherwise
/// the bernstein polynoms are used to evaluate the spline at a given location.
///
template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false
template<typename Time= double, typename Numeric=Time, Eigen::Index Dim=3, bool Safe=false
, typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
{
......
......@@ -18,7 +18,7 @@ namespace parametriccurves
/// \brief Creates InfiniteSinusoid curve
/// The sinusoid is actually a cosine so that it starts with zero velocity.
/// Returns x = x_init + A*cos(2*pi*f*t) where f is give by 1/(2*traj_time)
template<typename Numeric=double, std::size_t Dim=1,
template<typename Numeric=double, Eigen::Index Dim=1,
typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct Constant :
public AbstractCurve<Numeric, Point>
......
......@@ -19,7 +19,7 @@ namespace parametriccurves
/// \brief Creates InfiniteConstAcc curve
/// s = s_0 + u_0*t+0.5*a_0*t^2
template<typename Numeric=double, std::size_t Dim=1,
template<typename Numeric=double, Eigen::Index Dim=1,
typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct InfiniteConstAcc :
public AbstractCurve<Numeric, Point>
......
......@@ -18,7 +18,7 @@ namespace parametriccurves
/// \brief Creates InfiniteSinusoid curve
/// The sinusoid is actually a cosine so that it starts with zero velocity.
/// Returns x = x_init + A*cos(2*pi*f*t) where f is give by 1/(2*traj_time)
template<typename Numeric=double, std::size_t Dim=1,
template<typename Numeric=double, Eigen::Index Dim=1,
typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct InfiniteSinusoid :
public AbstractCurve<Numeric, Point>
......
......@@ -21,7 +21,7 @@ namespace parametriccurves
* In particular the frequency starts from a value f0 and it increases linearly
* up to a value f1. Then it goes back to f0 and the trajectory is ended.
*/
template<typename Numeric=double, std::size_t Dim=1,
template<typename Numeric=double, Eigen::Index Dim=1,
typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct LinearChirp :
public AbstractCurve<Numeric, Point>
......
......@@ -17,7 +17,7 @@ namespace parametriccurves
/** \class MinimumJerk
* \brief Creates MinimumJerk curve
*/
template<typename Numeric=double, std::size_t Dim=1,
template<typename Numeric=double, Eigen::Index Dim=1,
typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct MinimumJerk :
public AbstractCurve<Numeric, Point>
......
......@@ -24,7 +24,7 @@ namespace spline
{
/// \class SplineOptimizer
/// \brief Mosek connection to produce optimized splines
template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false
template<typename Time= double, typename Numeric=Time, Eigen::Index Dim=3, bool Safe=false
, typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct SplineOptimizer
{
......@@ -79,7 +79,7 @@ private:
typedef std::vector<waypoint_t> T_waypoints_t;
};
template<typename Time, typename Numeric, std::size_t Dim, bool Safe, typename Point>
template<typename Time, typename Numeric, Eigen::Index Dim, bool Safe, typename Point>
template<typename In>
inline void SplineOptimizer<Time, Numeric, Dim, Safe, Point>::ComputeHMatrices(In wayPointsBegin, In wayPointsEnd,
MatrixX& h1, MatrixX& h2, MatrixX& h3, MatrixX& h4) const
......
......@@ -29,7 +29,7 @@ namespace parametriccurves
/// [tBegin, tEnd]. It follows the equation
/// x(t) = a + b(t - t_min_) + ... + d(t - t_min_)^N, where N is the order
///
template<typename Numeric=double, std::size_t Dim=3,
template<typename Numeric=double, Eigen::Index Dim=3,
typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct Polynomial :
public parametriccurves::AbstractCurve<Numeric, Point>
......
......@@ -27,7 +27,7 @@ namespace spatial
using parametriccurves::Spline;
/// \class ForceCurve
/// \brief Representation of a spatial vector curve in the form of splines
/// \brief Representation of a spatial vector curve in the form of splines
/// Returns Plucker coordinates in the form of (Linear(3), Angular(3))
///
template<typename Numeric=double>
......@@ -50,7 +50,7 @@ public:
: curve_abc_t()
{
}
///\brief Constructor
///\param subSplines: vector of subsplines
ForceCurve(const spline_lin_t &linPart_, const spline_ang_t &angPart_)
......@@ -58,17 +58,17 @@ public:
linPart(linPart_),
angPart(angPart_),
motionVector(motion_t::Zero()) {}
///\brief Copy Constructor
ForceCurve(const ForceCurve &other)
: curve_abc_t(other.linPart.tmin(), other.linPart.tmax()),
linPart(other.linPart),
angPart(other.angPart),
motionVector(motion_t::Zero()) {}
///\brief Destructor
~ForceCurve(){}
public:
virtual const force_t operator()(const time_t& t) const
{
......@@ -102,7 +102,7 @@ public:
{
return false;
}
protected:
/*Attributes*/
spline_lin_t linPart; // const
......@@ -112,7 +112,7 @@ protected:
private:
// Serialization of the class
friend class boost::serialization::access;
friend class boost::serialization::access;
template<class Archive>
void save(Archive & ar, const unsigned int /*version*/) const
{
......@@ -121,7 +121,7 @@ private:
return;
}
template<class Archive>
void load(Archive & ar, const unsigned int /*version*/)
{
......@@ -136,7 +136,7 @@ private:
assert(this->t_max == angPart.tmax());
return;
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
public:
......@@ -155,7 +155,7 @@ public:
}
return true;
}
/// \brief Saved a Derived object as a text file.
bool saveToFile(const std::string & filename) const throw (std::invalid_argument)
{
......
......@@ -38,7 +38,7 @@ T_Point make_cubic_vector(Point const& a, Point const& b, Point const& c, Point
return res;
}
template<typename Numeric, std::size_t Dim, typename Point, typename T_Point>
template<typename Numeric, Eigen::Index Dim, typename Point, typename T_Point>
Polynomial<Numeric,Dim,Point> create_cubic(Point const& a, Point const& b,
Point const& c, Point const &d,
const Numeric min, const Numeric max)
......@@ -60,7 +60,7 @@ T_Point make_quintic_vector(Point const& a, Point const& b, Point const& c,
return res;
}
template<typename Numeric, std::size_t Dim, typename Point, typename T_Point>
template<typename Numeric, Eigen::Index Dim, typename Point, typename T_Point>
Polynomial<Numeric,Dim,Point> create_quintic(Point const& a, Point const& b,
Point const& c, Point const &d,
Point const &e, Point const &f,
......@@ -74,7 +74,7 @@ Polynomial<Numeric,Dim,Point> create_quintic(Point const& a, Point const& b,
/// \brief Represents a set of cubic splines defining a continuous function
/// crossing each of the waypoint given in its initialization
///
template<typename Numeric=double, std::size_t Dim=Eigen::Dynamic,
template<typename Numeric=double, Eigen::Index Dim=Eigen::Dynamic,
typename Point= Eigen::Matrix<Numeric, Dim, 1>,
typename SplineBase=Polynomial<Numeric, Dim, Point> >
struct Spline :
......
......@@ -15,7 +15,7 @@ namespace parametriccurves
/// \class TextFile.
/// \brief Loads curve from file
template<typename Numeric=double, std::size_t Dim=Eigen::Dynamic,
template<typename Numeric=double, Eigen::Index Dim=Eigen::Dynamic,
typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct TextFile :
public AbstractCurve<Numeric, Point>
......
......@@ -258,15 +258,15 @@ void set_end_acc(curve_constraints_t& c, const point_t& val)
BOOST_PYTHON_MODULE(libparametric_curves_pywrap)
{
/** BEGIN eigenpy init**/
eigenpy::enableEigenPy();
eigenpy::enableEigenPySpecific<point_t,point_t>();
eigenpy::enableEigenPySpecific<ret_point_t,ret_point_t>();
eigenpy::enableEigenPySpecific<point_list_t,point_list_t>();
eigenpy::enableEigenPySpecific<point6_t,point6_t>();
eigenpy::enableEigenPySpecific<ret_point6_t,ret_point6_t>();
eigenpy::enableEigenPySpecific<point_list6_t,point_list6_t>();
eigenpy::enableEigenPySpecific<coeff_t,coeff_t>();
//eigenpy::enableEigenPy();
eigenpy::enableEigenPySpecific<point_t>();
eigenpy::enableEigenPySpecific<ret_point_t>();
eigenpy::enableEigenPySpecific<point_list_t>();
eigenpy::enableEigenPySpecific<point6_t>();
eigenpy::enableEigenPySpecific<ret_point6_t>();
eigenpy::enableEigenPySpecific<point_list6_t>();
eigenpy::enableEigenPySpecific<coeff_t>();
/*eigenpy::exposeAngleAxis();
eigenpy::exposeQuaternion();*/
/** END eigenpy init**/
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment