Skip to content
Snippets Groups Projects
Commit 210186eb authored by jcarpent's avatar jcarpent
Browse files

[Python] Expose kineticEnergy algo

parent 599fd965
No related branches found
No related tags found
No related merge requests found
//
// Copyright (c) 2015 CNRS
// Copyright (c) 2015-2016 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
......@@ -31,14 +31,15 @@
#include "pinocchio/algorithm/jacobian.hpp"
#include "pinocchio/algorithm/center-of-mass.hpp"
#include "pinocchio/algorithm/joint-limits.hpp"
#include "pinocchio/algorithm/energy.hpp"
#include "pinocchio/simulation/compute-all-terms.hpp"
#ifdef WITH_HPP_FCL
#include "pinocchio/multibody/geometry.hpp"
#include "pinocchio/python/geometry-model.hpp"
#include "pinocchio/python/geometry-data.hpp"
#include "pinocchio/algorithm/collisions.hpp"
#include "pinocchio/multibody/geometry.hpp"
#include "pinocchio/python/geometry-model.hpp"
#include "pinocchio/python/geometry-data.hpp"
#include "pinocchio/algorithm/collisions.hpp"
#endif
namespace se3
......@@ -153,6 +154,15 @@ namespace se3
{
jointLimits(*model,*data,q);
}
static double kineticEnergy_proxy(const ModelHandler & model,
DataHandler & data,
const VectorXd_fx & q,
const VectorXd_fx & v,
const bool update_kinematics = true)
{
return kineticEnergy(*model,*data,q,v,update_kinematics);
}
#ifdef WITH_HPP_FCL
static bool computeCollisions_proxy(GeometryDataHandler & data_geom,
......@@ -275,7 +285,16 @@ namespace se3
bp::args("Model","Data",
"Configuration q (size Model::nq)"),
"Compute the maximum limits of all the joints of the model "
"and put the results in data.");
"and put the results in data.");
bp::def("kineticEnergy",kineticEnergy_proxy,
bp::args("Model","Data",
"Configuration q (size Model::nq)",
"Velocity v (size Model::nv)",
"Update kinematics (bool)"),
"Compute the kinematic energy of the model for the "
"given joint configuration and velocity and store it "
" in data.kinetic_energy. By default, the kinematics of model is updated.");
#ifdef WITH_HPP_FCL
bp::def("computeCollisions",computeCollisions_proxy,
......
//
// Copyright (c) 2015 CNRS
// Copyright (c) 2015-2016 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
......@@ -102,6 +102,8 @@ namespace se3
.ADD_DATA_PROPERTY_CONST(Eigen::VectorXd,lowerPositionLimit,"Limit for joint lower position")
.ADD_DATA_PROPERTY_CONST(Eigen::VectorXd,upperPositionLimit,"Limit for joint upper position")
.ADD_DATA_PROPERTY_CONST(double,kinetic_energy,"Kinetic energy in [J] computed by kineticEnergy(model,data,q,v,True/False)")
;
}
......@@ -135,6 +137,8 @@ namespace se3
IMPL_DATA_PROPERTY_CONST(Eigen::VectorXd,lowerPositionLimit,"Limit for joint lower position")
IMPL_DATA_PROPERTY_CONST(Eigen::VectorXd,upperPositionLimit,"Limit for joint upper position")
IMPL_DATA_PROPERTY_CONST(double,kinetic_energy,"Kinetic energy in [J] computed by kineticEnergy(model,data,q,v,True/False)")
static Vector3d_fx com_pos (DataHandler & d, int i) { return d->com[(size_t) i]; }
static Vector3d_fx com_vel (DataHandler & d, int i) { return d->vcom[(size_t) i]; }
static Vector3d_fx com_acc (DataHandler & d, int i) { return d->acom[(size_t) i]; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment