-
Notifications
You must be signed in to change notification settings - Fork 3
/
hexapod.hh
36 lines (30 loc) · 1.03 KB
/
hexapod.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef ROBOT_HEXAPOD_HPP
#define ROBOT_HEXAPOD_HPP
#include "robot/robot.hh"
#include "ode/environment_hexa.hh"
namespace robot {
class Hexapod : public Robot {
public:
Hexapod(ode::Environment_hexa& env, const Eigen::Vector3d& pos, std::vector<int> brokenLegs) : _brokenLegs(brokenLegs)
{
_build(env, pos);
/*std::cout<<_bodies.size()<<std::endl;
for(int i=0; i<_bodies.size();i++)
std::cout<< _bodies[i]->get_pos()<<std::endl;*/
}
Hexapod(const Hexapod& o, ode::Environment_hexa& env) : Robot(o, env)
{
for (size_t i = 1; i < _bodies.size(); i++) {
env.add_leg_object((i - 1) / 3, *_bodies[i]);
}
}
boost::shared_ptr<Hexapod> clone(ode::Environment_hexa& env) const
{
return boost::shared_ptr<Hexapod>(new Hexapod(*this, env));
}
protected:
std::vector<int> _brokenLegs;
void _build(ode::Environment_hexa& env, const Eigen::Vector3d& pos);
};
}
#endif