Crocoddyl
 
Loading...
Searching...
No Matches
pinocchio_cast.hpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2025-2025, Heriot-Watt University
5// Copyright note valid unless otherwise stated in individual files.
6// All rights reserved.
8
9#ifndef CROCODDYL_MULTIBODY_CODEGEN_PINOCCHIO_CAST_HPP_
10#define CROCODDYL_MULTIBODY_CODEGEN_PINOCCHIO_CAST_HPP_
11
12#include <pinocchio/autodiff/cppad.hpp>
13
14#include "crocoddyl/multibody/fwd.hpp"
15
16namespace pinocchio {
17
18#if !PINOCCHIO_VERSION_AT_LEAST(3, 5, 0)
19// Implement missing casting in Pinocchio
20template <typename NewScalar, typename Scalar>
21struct ScalarCast<NewScalar, CppAD::cg::CG<Scalar>> {
22 static NewScalar cast(const CppAD::cg::CG<Scalar>& cg_value) {
23 return static_cast<NewScalar>(cg_value.getValue());
24 }
25};
26#endif
27
28} // namespace pinocchio
29
30#endif // CROCODDYL_MULTIBODY_CODEGEN_PINOCCHIO_CAST_HPP_