sot-talos-controller.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2016,
3  *
4  * Olivier Stasse
5  *
6  * LAAS, CNRS
7  *
8  * This file is part of TalosController.
9  */
10 
11 #ifndef _SOT_TalosController_H_
12 #define _SOT_TalosController_H_
13 
14 #include <dynamic-graph/entity.h>
15 #include <dynamic-graph/linear-algebra.h>
16 #include <dynamic-graph/signal-ptr.h>
17 #include <dynamic-graph/signal.h>
18 
19 #include <dynamic_graph_bridge/ros_interpreter.hh>
20 #include <pinocchio/fwd.hpp>
21 #include <sot/core/abstract-sot-external-interface.hh>
22 #include <sot/core/device.hh>
23 
24 #include "sot-talos-device.hh"
25 namespace dgsot = dynamicgraph::sot;
26 
27 class SoTTalosController : public dgsot::AbstractSotExternalInterface {
28  public:
29  static const std::string LOG_PYTHON;
30 
32  SoTTalosController(const char robotName[]);
33  SoTTalosController(std::string robotName);
34  virtual ~SoTTalosController();
35 
36  void setupSetSensors(std::map<std::string, dgsot::SensorValues> &sensorsIn);
37 
38  void nominalSetSensors(std::map<std::string, dgsot::SensorValues> &sensorsIn);
39 
40  void cleanupSetSensors(std::map<std::string, dgsot::SensorValues> &sensorsIn);
41 
42  void getControl(std::map<std::string, dgsot::ControlValues> &anglesOut);
43 
44  void setNoIntegration(void);
45  void setSecondOrderIntegration(void);
46 
48  boost::shared_ptr<dynamicgraph::Interpreter> interpreter_;
49 
50  boost::shared_ptr<ros::NodeHandle> nh_;
51  boost::shared_ptr<ros::AsyncSpinner> spinner_;
52 
53  protected:
54  // Update output port with the control computed from the
55  // dynamic graph.
56  void updateRobotState(std::vector<double> &anglesIn);
57 
59  void runPython(std::ostream &file, const std::string &command,
60  dynamicgraph::Interpreter &interpreter);
61 
62  virtual void startupPython();
63 
64  void init();
65 
67 };
68 
69 #endif /* _SOT_TalosController_H_ */
SoTTalosController::updateRobotState
void updateRobotState(std::vector< double > &anglesIn)
SoTTalosController::LOG_PYTHON
static const std::string LOG_PYTHON
Definition: sot-talos-controller.hh:29
SoTTalosController::spinner_
boost::shared_ptr< ros::AsyncSpinner > spinner_
Definition: sot-talos-controller.hh:51
SoTTalosController::cleanupSetSensors
void cleanupSetSensors(std::map< std::string, dgsot::SensorValues > &sensorsIn)
Definition: sot-talos-controller.cpp:71
SoTTalosController::init
void init()
Definition: sot-talos-controller.cpp:40
SoTTalosController::device_
SoTTalosDevice * device_
Definition: sot-talos-controller.hh:66
SoTTalosController::setNoIntegration
void setNoIntegration(void)
Definition: sot-talos-controller.cpp:89
SoTTalosController::interpreter_
boost::shared_ptr< dynamicgraph::Interpreter > interpreter_
Embedded python interpreter accessible via Corba/ros.
Definition: sot-talos-controller.hh:48
SoTTalosController
Definition: sot-talos-controller.hh:27
SoTTalosController::startupPython
virtual void startupPython()
Definition: sot-talos-controller.cpp:116
sot-talos-device.hh
SoTTalosController::~SoTTalosController
virtual ~SoTTalosController()
Definition: sot-talos-controller.cpp:57
SoTTalosController::nominalSetSensors
void nominalSetSensors(std::map< std::string, dgsot::SensorValues > &sensorsIn)
Definition: sot-talos-controller.cpp:66
SoTTalosController::SoTTalosController
SoTTalosController()
SoTTalosController::setupSetSensors
void setupSetSensors(std::map< std::string, dgsot::SensorValues > &sensorsIn)
Definition: sot-talos-controller.cpp:61
SoTTalosController::getControl
void getControl(std::map< std::string, dgsot::ControlValues > &anglesOut)
Definition: sot-talos-controller.cpp:76
SoTTalosController::runPython
void runPython(std::ostream &file, const std::string &command, dynamicgraph::Interpreter &interpreter)
Run a python command.
Definition: sot-talos-controller.cpp:95
SoTTalosController::nh_
boost::shared_ptr< ros::NodeHandle > nh_
Definition: sot-talos-controller.hh:50
SoTTalosController::setSecondOrderIntegration
void setSecondOrderIntegration(void)
Definition: sot-talos-controller.cpp:91
dynamicgraph::sot
Definition: sot-talos-device.cpp:379
SoTTalosDevice
Definition: sot-talos-device.hh:33