2 #include "typedefs.hpp"
3 #include <openrave/openrave.h>
10 TrajArray TRAJOPT_API
getTraj(
const DblVec& x,
const VarArray& vars);
11 TrajArray TRAJOPT_API
getTraj(
const DblVec& x,
const AffArray& arr);
15 inline Vector3d toVector3d(
const OR::Vector& v) {
16 return Vector3d(v.x, v.y, v.z);
18 inline Vector4d toVector4d(
const OR::Vector& v) {
19 return Vector4d(v.x, v.y, v.z, v.w);
21 Eigen::Matrix3d toRot(
const OR::Vector& rq);
23 inline OR::Transform toRaveTransform(
const Vector4d& q,
const Vector3d& p) {
24 return OR::Transform(OR::Vector(q[0], q[1], q[2], q[3]),
25 OR::Vector(p[0], p[1], p[2]));
27 inline DblVec trajToDblVec(
const TrajArray& x) {
28 return DblVec(x.data(), x.data()+x.rows()*x.cols());
31 inline VectorXd concat(
const VectorXd& a,
const VectorXd& b) {
32 VectorXd out(a.size()+b.size());
33 out.topRows(a.size()) = a;
34 out.middleRows(a.size(), b.size()) = b;
39 vector<T> concat(
const vector<T>& a,
const vector<T>& b) {
42 out.insert(out.end(), a.begin(), a.end());
43 out.insert(out.end(), b.begin(), b.end());
48 vector<T> singleton(
const T& x) {
49 return vector<T>(1,x);
53 void TRAJOPT_API AddVarArrays(OptProb& prob,
int rows,
const vector<int>& cols,
const vector<string>& name_prefix,
const vector<VarArray*>& newvars);
55 void TRAJOPT_API AddVarArray(OptProb& prob,
int rows,
int cols,
const string& name_prefix, VarArray& newvars);