Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright 2010 CNRS |
3 |
|
|
// |
4 |
|
|
// Author: Florent Lamiraux |
5 |
|
|
// |
6 |
|
|
|
7 |
|
|
#ifndef DYNAMIC_GRAPH_TUTORIAL_COMMAND_INCREMENT_HH |
8 |
|
|
#define DYNAMIC_GRAPH_TUTORIAL_COMMAND_INCREMENT_HH |
9 |
|
|
|
10 |
|
|
#include <boost/assign/list_of.hpp> |
11 |
|
|
|
12 |
|
|
namespace dynamicgraph { |
13 |
|
|
namespace tutorial { |
14 |
|
|
namespace command { |
15 |
|
|
using ::dynamicgraph::command::Command; |
16 |
|
|
using ::dynamicgraph::command::Value; |
17 |
|
|
class Increment : public Command { |
18 |
|
|
public: |
19 |
|
✗ |
virtual ~Increment() {} |
20 |
|
|
/// Create a command and store it in Entity |
21 |
|
|
/// \param entity Instance of Entity owning of the command |
22 |
|
|
/// \param docstring documentation of the command |
23 |
|
✗ |
Increment(InvertedPendulum& entity, const std::string& docstring) |
24 |
|
✗ |
: Command(entity, boost::assign::list_of(Value::DOUBLE), docstring) {} |
25 |
|
✗ |
virtual Value doExecute() { |
26 |
|
✗ |
Entity& entity = owner(); |
27 |
|
✗ |
InvertedPendulum& ip = static_cast<InvertedPendulum&>(entity); |
28 |
|
✗ |
std::vector<Value> values = getParameterValues(); |
29 |
|
✗ |
double timeStep = values[0].value(); |
30 |
|
✗ |
ip.incr(timeStep); |
31 |
|
✗ |
return Value(); |
32 |
|
|
} |
33 |
|
|
}; // class Increment |
34 |
|
|
} // namespace command |
35 |
|
|
} // namespace tutorial |
36 |
|
|
} // namespace dynamicgraph |
37 |
|
|
#endif // DYNAMIC_GRAPH_TUTORIAL_COMMAND_INCREMENT_HH |
38 |
|
|
|