dynamic-command.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * Florent Lamiraux
4  *
5  * CNRS/AIST
6  *
7  */
8 
9 #ifndef DYNAMIC_COMMAND_H
10 #define DYNAMIC_COMMAND_H
11 
14 #include <dynamic-graph/command.h>
15 
16 #include <boost/assign/list_of.hpp>
17 #include <fstream>
18 
19 namespace dynamicgraph {
20 namespace sot {
21 namespace command {
22 using ::dynamicgraph::command::Command;
23 using ::dynamicgraph::command::Value;
24 
25 // Command DisplayModel
26 class DisplayModel : public Command {
27  public:
28  virtual ~DisplayModel() {
29  sotDEBUGIN(15);
30  sotDEBUGOUT(15);
31  }
35  DisplayModel(DynamicPinocchio& entity, const std::string& docstring)
36  : Command(entity, std::vector<Value::Type>(), docstring) {}
37  virtual Value doExecute() {
38  DynamicPinocchio& robot = static_cast<DynamicPinocchio&>(owner());
39  robot.displayModel();
40  return Value();
41  }
42 }; // class DisplayModel
43 
44 // Command GetDimension
45 class GetDimension : public Command {
46  public:
47  virtual ~GetDimension() {
48  sotDEBUGIN(15);
49  sotDEBUGOUT(15);
50  }
54  GetDimension(DynamicPinocchio& entity, const std::string& docstring)
55  : Command(entity, std::vector<Value::Type>(), docstring) {}
56  virtual Value doExecute() {
57  DynamicPinocchio& robot = static_cast<DynamicPinocchio&>(owner());
58  unsigned int dimension = robot.m_model->nv;
59  return Value(dimension);
60  }
61 }; // class GetDimension
62 
63 // Command getJointNames
64 class GetJointNames : public Command {
65  public:
69  GetJointNames(DynamicPinocchio& entity, const std::string& docstring)
70  : Command(entity, std::vector<Value::Type>(), docstring) {}
71  virtual Value doExecute() {
72  DynamicPinocchio& robot = static_cast<DynamicPinocchio&>(owner());
73  if (robot.m_model == 0x0) {
75  "model has not been initialized.");
76  }
77  const std::vector<std::string>& jointNames = robot.m_model->names;
78  // Remove first joint names 'universe'
79  assert(jointNames.size() >= 1);
80  std::vector<Value> res;
81  for (std::size_t i = 1; i < jointNames.size(); ++i) {
82  res.push_back(Value(jointNames[i]));
83  }
84  return Value(res);
85  }
86 };
87 } // namespace command
88 } /* namespace sot */
89 } /* namespace dynamicgraph */
90 
91 #endif // DYNAMIC_COMMAND_H
dynamicgraph
dynamicgraph::sot::ExceptionDynamic
i
int i
dynamicgraph::sot::DynamicPinocchio
This class provides an inverse dynamic model of the robot. More precisely it wraps the newton euler a...
Definition: dynamic-pinocchio.h:79
command-getter.h
dynamicgraph::sot::command::GetJointNames::doExecute
virtual Value doExecute()
Definition: dynamic-command.h:71
dynamicgraph::sot::command::DisplayModel::DisplayModel
DisplayModel(DynamicPinocchio &entity, const std::string &docstring)
Definition: dynamic-command.h:35
dynamicgraph::sot::command::GetDimension::~GetDimension
virtual ~GetDimension()
Definition: dynamic-command.h:47
dynamicgraph::sot::command::GetJointNames::GetJointNames
GetJointNames(DynamicPinocchio &entity, const std::string &docstring)
Definition: dynamic-command.h:69
dynamicgraph::sot::command::DisplayModel
Definition: dynamic-command.h:26
dynamicgraph::sot::command::GetDimension::GetDimension
GetDimension(DynamicPinocchio &entity, const std::string &docstring)
Definition: dynamic-command.h:54
dynamicgraph::sot::command::DisplayModel::~DisplayModel
virtual ~DisplayModel()
Definition: dynamic-command.h:28
res
res
command-setter.h
sotDEBUGOUT
#define sotDEBUGOUT(level)
dynamicgraph::sot::command::GetDimension
Definition: dynamic-command.h:45
sotDEBUGIN
#define sotDEBUGIN(level)
dynamic_pinocchio.kine_romeo.robot
robot
Definition: kine_romeo.py:31
dynamicgraph::sot::command::DisplayModel::doExecute
virtual Value doExecute()
Definition: dynamic-command.h:37
dynamicgraph::sot::command::GetDimension::doExecute
virtual Value doExecute()
Definition: dynamic-command.h:56
x0
x0
dynamicgraph::sot::ExceptionDynamic::GENERIC
GENERIC
Type
Eigen::Block< Mat > Type
SOT_THROW
#define SOT_THROW
command.h
sot
Definition: zmp-from-forces.cpp:11
dynamicgraph::sot::command::GetJointNames
Definition: dynamic-command.h:64


sot-dynamic-pinocchio
Author(s): Olivier Stasse
autogenerated on Fri Jul 28 2023 02:10:01