wbc
PotentialField.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <base/Eigen.hpp>
4#include <base/Time.hpp>
5#include <stdexcept>
6#include <memory>
7
8namespace wbc{
9
14public:
16 PotentialField(const uint _dimension, const std::string& _name = "unset")
17 : dimension(_dimension),
18 name(_name){
19 if(dimension == 0)
20 throw std::invalid_argument("PotentialField:PotentialField: Dimension of Potential Field has to be > 0");
21
22 influence_distance = std::numeric_limits<double>::infinity(); //Initialize with inifinite maximum influence distance
23 distance.setConstant(dimension, std::numeric_limits<double>::quiet_NaN());
24 gradient.setConstant(dimension, std::numeric_limits<double>::quiet_NaN());
25 pot_field_center.setConstant(dimension, std::numeric_limits<double>::quiet_NaN());
26 }
27
28 virtual ~PotentialField(){}
29
34 virtual const base::VectorXd& update(const base::VectorXd &position) = 0;
35
36 base::Time time;
37
40
43
45 base::VectorXd distance;
46
48 base::VectorXd pot_field_center;
49
51 base::VectorXd gradient;
52
54 const std::string name;
55};
56
57typedef std::shared_ptr<PotentialField> PotentialFieldPtr;
58
59}
60
Base class for potential fields.
Definition PotentialField.hpp:13
const std::string name
Definition PotentialField.hpp:54
base::VectorXd gradient
Definition PotentialField.hpp:51
base::VectorXd pot_field_center
Definition PotentialField.hpp:48
PotentialField(const uint _dimension, const std::string &_name="unset")
Definition PotentialField.hpp:16
base::VectorXd distance
Definition PotentialField.hpp:45
uint dimension
Definition PotentialField.hpp:39
base::Time time
Definition PotentialField.hpp:36
virtual const base::VectorXd & update(const base::VectorXd &position)=0
Implement in derived class. Compute control update according to potential field equation.
virtual ~PotentialField()
Definition PotentialField.hpp:28
double influence_distance
Definition PotentialField.hpp:42
Definition ContactsAccelerationConstraint.cpp:3
std::shared_ptr< PotentialField > PotentialFieldPtr
Definition PotentialField.hpp:57