Go to the documentation of this file. 1 #ifndef CNOID_MANIPULATOR_PLUGIN_MPR_CONTROLLR_ITEM_BASE_H
2 #define CNOID_MANIPULATOR_PLUGIN_MPR_CONTROLLR_ITEM_BASE_H
4 #include <cnoid/ControllerItem>
9 #include "exportdecl.h"
13 class MprProgramItemBase;
16 class LinkKinematicsKit;
28 virtual double timeStep()
const override;
29 double speedRatio()
const;
30 void setSpeedRatio(
double r);
32 virtual bool initialize(
ControllerIO* io)
override final;
33 virtual bool start()
override final;
34 virtual void input()
override final;
35 virtual bool control()
override final;
36 virtual void output()
override final;
37 virtual void stop()
override final;
40 template<
class StatementType>
42 registerStatementInterpreter(
43 typeid(StatementType),
45 return interpret(
static_cast<StatementType*
>(statement)); });
47 void registerBaseStatementInterpreters();
49 void setResidentInputFunction(std::function<
void()> input);
70 MprProgram* findProgram(
const std::string& name);
74 void pushControlFunctions(
75 std::function<
bool()> control, std::function<
void()> input =
nullptr, std::function<
void()> output =
nullptr);
77 void pushOutputOnceFunction(std::function<
void()> outputOnce);
80 virtual bool onStart();
81 virtual bool onStop();
84 virtual bool initializeVariables();
86 virtual stdx::optional<MprVariable::Value> evalExpressionAsVariableValue(
87 std::string::const_iterator& io_expressionBegin, std::string::const_iterator expressionEnd);
88 virtual std::function<bool(
MprVariable::Value value)> evalExpressionAsVariableToAssginValue(
89 const std::string& expression);
91 virtual void onDisconnectedFromRoot()
override;
93 virtual bool store(
Archive& archive)
override;
94 virtual bool restore(
const Archive& archive)
override;
97 void registerStatementInterpreter(
98 std::type_index statementType,
const std::function<
bool(
MprStatement* statement)>& interpret);
117 std::shared_ptr<std::string> topLevelProgramName_;
118 std::vector<int> hierachicalPosition_;
Definition: ExtensionManager.h:23
Definition: PutPropertyFunction.h:51
Definition: MprProgramItemBase.h:16
ref_ptr< MprControllerItemBase > MprControllerItemBasePtr
Definition: MprControllerItemBase.h:104
bool isErrorState() const
Definition: MprControllerItemBase.h:114
Definition: ControllerIO.h:16
Definition: ControllerItem.h:20
Definition: Referenced.h:103
stdx::variant< int, double, bool, std::string > Value
Definition: MprVariable.h:18
std::shared_ptr< const std::string > sharedTopLevelProgramName() const
Definition: MprControllerItemBase.h:112
Definition: AbstractSceneLoader.h:11
Definition: LinkKinematicsKit.h:23
Definition: MprStatement.h:16
Definition: MprVariableList.h:12
Definition: Referenced.h:54
Definition: MprProgram.h:21
const std::vector< int > & hierachicalPosition() const
Definition: MprControllerItemBase.h:113
Definition: MprControllerItemBase.h:107
void registerStatementInterpreter(std::function< bool(StatementType *statement)> interpret)
Definition: MprControllerItemBase.h:41
ref_ptr< MprControllerLog > MprControllerLogPtr
Definition: MprControllerItemBase.h:124
StatementContainer::iterator iterator
Definition: MprProgram.h:25
const std::string & topLevelProgramName() const
Definition: MprControllerItemBase.h:111
Definition: MprControllerItemBase.h:19