NJointControllerBase Class Referenceabstract

A high level controller writing its results into ControlTargets. More...

#include <RobotAPI/components/units/RobotUnit/NJointControllers/NJointControllerBase.h>

+ Inheritance diagram for NJointControllerBase:

Public Types

using ConfigPtrT = NJointControllerConfigPtr
 
using GenerateConfigDescriptionFunctionSignature = WidgetDescription::WidgetPtr(*)(const VirtualRobot::RobotPtr &, const std::map< std::string, ConstControlDevicePtr > &controlDevices, const std::map< std::string, ConstSensorDevicePtr > &sensorDevices)
 
template<class ConfigPrtType >
using GenerateConfigFromVariantsFunctionSignature = ConfigPrtType(*)(const StringVariantBaseMap &)
 
- Public Types inherited from ManagedIceObject
using PeriodicTaskPtr = IceUtil::Handle< SimplePeriodicTask< std::function< void(void)> >>
 

Public Member Functions

void activateController (const Ice::Current &=Ice::emptyCurrent) final override
 
void callDescribedFunction (const std::string &, const StringVariantBaseMap &, const Ice::Current &=Ice::emptyCurrent) override
 
void deactivateAndDeleteController (const Ice::Current &=Ice::emptyCurrent) final override
 
void deactivateController (const Ice::Current &=Ice::emptyCurrent) final override
 
void deleteController (const Ice::Current &=Ice::emptyCurrent) final override
 
std::string getClassName (const Ice::Current &=Ice::emptyCurrent) const override=0
 
const std::map< std::string, const JointController * > & getControlDevicesUsedJointController ()
 
const std::vector< char > & getControlDeviceUsedBitmap () const
 
StringStringDictionary getControlDeviceUsedControlModeMap (const Ice::Current &=Ice::emptyCurrent) const final override
 
const std::vector< std::size_t > & getControlDeviceUsedIndices () const
 
NJointControllerDescription getControllerDescription (const Ice::Current &=Ice::emptyCurrent) const final override
 
NJointControllerDescriptionWithStatus getControllerDescriptionWithStatus (const Ice::Current &=Ice::emptyCurrent) const final override
 
NJointControllerStatus getControllerStatus (const Ice::Current &=Ice::emptyCurrent) const final override
 
WidgetDescription::StringWidgetDictionary getFunctionDescriptions (const Ice::Current &=Ice::emptyCurrent) const override
 
std::string getInstanceName (const Ice::Current &=Ice::emptyCurrent) const final override
 
bool hasControllerError (const Ice::Current &=Ice::emptyCurrent) const final override
 
bool isControllerActive (const Ice::Current &=Ice::emptyCurrent) const final override
 
bool isControllerRequested (const Ice::Current &=Ice::emptyCurrent) const final override
 
bool isDeletable (const Ice::Current &=Ice::emptyCurrent) const final override
 
std::optional< std::vector< char > > isNotInConflictWith (const NJointControllerBasePtr &other) const
 
std::optional< std::vector< char > > isNotInConflictWith (const std::vector< char > &used) const
 
 NJointControllerBase ()
 
ConstControlDevicePtr peekControlDevice (const std::string &deviceName) const
 Get a const ptr to the given ControlDevice. More...
 
ConstSensorDevicePtr peekSensorDevice (const std::string &deviceName) const
 Get a const ptr to the given SensorDevice. More...
 
const std::string & rtGetClassName () const
 Returns the class name. More...
 
const std::vector< std::size_t > & rtGetControlDeviceUsedIndices () const
 Returns the indices of all ControlDevice's this NJointControllerBase calculates a ControlTarget for. More...
 
bool rtGetErrorState () const
 Sets the error state to true. More...
 
const std::string & rtGetInstanceName () const
 Returns the instance name. More...
 
std::size_t rtGetNumberOfUsedControlDevices () const
 Returns the number of used ControlDevices. More...
 
const VirtualRobot::RobotPtrrtGetRobot ()
 TODO make protected and use attorneys. More...
 
const std::vector< VirtualRobot::RobotNodePtr > & rtGetRobotNodes ()
 Returns the nodes of the virtual robot used by this NJointControllerBase in the rtRun. More...
 
bool rtUsesControlDevice (std::size_t deviceIndex) const
 Returns whether this NJointControllerBase calculates a ControlTarget for the given ControlDevice. More...
 
ControlTargetBaseuseControlTarget (const std::string &deviceName, const std::string &controlMode)
 Declares to calculate the ControlTarget for the given ControlDevice in the given ControlMode when rtRun is called. More...
 
template<class T >
TuseControlTarget (const std::string &deviceName, const std::string &controlMode)
 Declares to calculate the ControlTarget for the given ControlDevice in the given ControlMode when rtRun is called. More...
 
template<class T >
const TuseSensorValue (const std::string &deviceName) const
 Get a const ptr to the given SensorDevice's SensorValue. More...
 
const SensorValueBaseuseSensorValue (const std::string &sensorDeviceName) const
 Get a const ptr to the given SensorDevice's SensorValue. More...
 
const VirtualRobot::RobotPtruseSynchronizedRtRobot (bool updateCollisionModel=false)
 Requests a VirtualRobot for use in rtRun *. More...
 
 ~NJointControllerBase () override
 
- Public Member Functions inherited from ManagedIceObject
void enableProfiler (bool enable)
 setProfiler allows setting ManagedIceObject::profiler to a new instance (if the new instance is actually not a null pointer) More...
 
std::string generateSubObjectName (const std::string &subObjectName)
 Generates a unique name for a sub object from a general name. More...
 
ArmarXManagerPtr getArmarXManager () const
 Returns the ArmarX manager used to add and remove components. More...
 
ManagedIceObjectConnectivity getConnectivity () const
 Retrieve connectivity of the object (topcis as well as proxies) More...
 
IceManagerPtr getIceManager () const
 Returns the IceManager. More...
 
VariantBasePtr getMetaInfo (const std::string &id)
 
StringVariantBaseMap getMetaInfoMap () const
 
std::string getName () const
 Retrieve name of object. More...
 
Ice::ObjectAdapterPtr getObjectAdapter () const
 Returns object's Ice adapter. More...
 
ArmarXObjectSchedulerPtr getObjectScheduler () const
 
PeriodicTaskPtr getPeriodicTask (const std::string &name)
 
Profiler::ProfilerPtr getProfiler () const
 getProfiler returns an instance of armarx::Profiler More...
 
template<class ProxyTarg , class... Args>
void getProxy (const char *name, IceInternal::ProxyHandle< ProxyTarg > &proxy, Args &&...args)
 
template<class ProxyType >
ProxyType getProxy (const std::string &name, bool addToDependencies=false, const std::string &endpoints="", bool throwOnProxyError=true)
 Retrieves a proxy object. More...
 
template<class ProxyTarg , class... Args>
void getProxy (const std::string &name, IceInternal::ProxyHandle< ProxyTarg > &proxy, Args &&...args)
 
template<class ProxyTarg , class... Args>
void getProxy (IceInternal::ProxyHandle< ProxyTarg > &proxy, const char *name, Args &&...args)
 
template<class ProxyTarg , class... Args>
void getProxy (IceInternal::ProxyHandle< ProxyTarg > &proxy, const std::string &name, Args &&...args)
 Assigns a proxy to proxy. More...
 
Ice::ObjectPrx getProxy (long timeoutMs=0, bool waitForScheduler=true) const
 Returns the proxy of this object (optionally it waits for the proxy) More...
 
template<class Prx >
Prx getProxy (long timeoutMs=0, bool waitForScheduler=true) const
 
template<class ProxyType >
void getProxy (ProxyType &proxy, const char *name, bool addToDependencies=false, const std::string &endpoints="", bool throwOnProxyError=true)
 Overload to allow using string literals as name (solve ambiguous overload). More...
 
template<class Prx >
void getProxy (Prx &prx, long timeoutMs=0, bool waitForScheduler=true) const
 
int getState () const
 Retrieve current state of the ManagedIceObject. More...
 
template<class TopicProxyType >
TopicProxyType getTopic (const std::string &name)
 Returns a proxy of the specified topic. More...
 
template<class TopicProxyType >
void getTopic (TopicProxyType &topicProxy, const std::string &name)
 Assigns a proxy of the specified topic to topicProxy. More...
 
std::vector< std::string > getUnresolvedDependencies () const
 returns the names of all unresolved dependencies More...
 
 ManagedIceObject (ManagedIceObject const &other)
 
void offeringTopic (const std::string &name)
 Registers a topic for retrival after initialization. More...
 
void preambleGetTopic (std::string const &name)
 
void setMetaInfo (const std::string &id, const VariantBasePtr &value)
 Allows to set meta information that can be queried live via Ice interface on the ArmarXManager. More...
 
void startPeriodicTask (const std::string &uniqueName, std::function< void(void)> f, int periodMs, bool assureMeanInterval=false, bool forceSystemTime=true)
 
bool stopPeriodicTask (const std::string &name)
 
bool unsubscribeFromTopic (const std::string &name)
 Unsubscribe from a topic. More...
 
bool usingProxy (const std::string &name, const std::string &endpoints="")
 Registers a proxy for retrieval after initialization and adds it to the dependency list. More...
 
void usingTopic (const std::string &name, bool orderedPublishing=false)
 Registers a proxy for subscription after initialization. More...
 
void waitForObjectScheduler ()
 Waits until the ObjectScheduler could resolve all dependencies. More...
 
void waitForProxy (std::string const &name, bool addToDependencies)
 
- Public Member Functions inherited from Logging
SpamFilterDataPtr deactivateSpam (float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
 disables the logging for the current line for the given amount of seconds. More...
 
MessageTypeT getEffectiveLoggingLevel () const
 
 Logging ()
 
void setLocalMinimumLoggingLevel (MessageTypeT level)
 With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set. More...
 
void setTag (const LogTag &tag)
 
void setTag (const std::string &tagName)
 
virtual ~Logging ()
 

Static Public Member Functions

template<class ItT >
static std::optional< std::vector< char > > AreNotInConflict (ItT first, ItT last)
 
- Static Public Member Functions inherited from ManagedIceObject
static std::string generateSubObjectName (const std::string &superObjectName, const std::string &subObjectName)
 Generates a unique name for a sub object from a general name and unique name. More...
 
static std::string GetObjectStateAsString (int state)
 

Static Public Attributes

static const NJointControllerBasePtr NullPtr {nullptr}
 
- Static Public Attributes inherited from ManagedIceObject
static const ManagedIceObjectPtr NullPtr
 A nullptr to be used when a const ref to a nullptr is required. More...
 

Protected Member Functions

std::string getDefaultName () const override
 
ThreadPoolPtr getThreadPool () const
 
void onConnectComponent () final
 
virtual void onConnectNJointController ()
 
void onDisconnectComponent () final
 
virtual void onDisconnectNJointController ()
 
void onExitComponent () final
 
virtual void onExitNJointController ()
 
void onInitComponent () final
 
virtual void onInitNJointController ()
 
virtual void onPublish (const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &)
 
virtual void onPublishActivation (const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &)
 
virtual void onPublishDeactivation (const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &)
 
virtual void rtPostDeactivateController ()
 This function is called after the controller is deactivated. More...
 
virtual void rtPreActivateController ()
 This function is called before the controller is activated. More...
 
void rtSetErrorState ()
 Sets the error state to true. More...
 
template<typename Task >
void runTask (const std::string &taskName, Task &&task)
 Executes a given task in a separate thread from the Application ThreadPool. More...
 
- Protected Member Functions inherited from ManagedIceObject
template<class PluginT , class... ParamsT>
PluginT * addPlugin (const std::string prefix="", ParamsT &&...params)
 
template<class PluginT , class... ParamsT>
void addPlugin (PluginT *&targ, const std::string prefix="", ParamsT &&...params)
 
template<class PluginT , class... ParamsT>
void addPlugin (std::experimental::observer_ptr< PluginT > &targ, const std::string prefix="", ParamsT &&...params)
 
Ice::CommunicatorPtr getCommunicator () const
 
std::unique_ptr< ManagedIceObjectPlugin > & getPluginPointer (std::type_info const &type, std::string const &prefix)
 
 ManagedIceObject ()
 Protected default constructor. More...
 
virtual void postOnConnectComponent ()
 
virtual void postOnDisconnectComponent ()
 
virtual void postOnExitComponent ()
 
virtual void postOnInitComponent ()
 
virtual void preOnConnectComponent ()
 
virtual void preOnDisconnectComponent ()
 
virtual void preOnExitComponent ()
 
virtual void preOnInitComponent ()
 
bool removeProxyDependency (const std::string &name)
 This function removes the dependency of this object on the in parameter name specified object. More...
 
void setName (std::string name)
 Override name of well-known object. More...
 
void terminate ()
 Initiates termination of this IceManagedObject. More...
 
 ~ManagedIceObject () override
 
- Protected Member Functions inherited from Logging
bool checkLogLevel (MessageTypeT level) const
 
const LogSenderPtrgetLogSender () const
 Retrieve log sender. More...
 
LogSenderPtr loghelper (const char *file, int line, const char *function) const
 

Protected Attributes

std::map< std::string, std::shared_ptr< ThreadPool::Handle > > threadHandles
 
std::mutex threadHandlesMutex
 
- Protected Attributes inherited from Logging
MessageTypeT minimumLoggingLevel
 
SpamFilterDataPtr spamFilter
 
LogTag tag
 

Friends

template<class >
class detail::NJointControllerRegistryEntryHelper
 This is required for the factory. More...
 
class RobotUnitModule::NJointControllerAttorneyForControllerManagement
 This class allows minimal access to private members of NJointControllerBase in a sane fashion for RobotUnitModule::ControllerManagement. More...
 
class RobotUnitModule::NJointControllerAttorneyForControlThread
 This class allows minimal access to private members of NJointControllerBase in a sane fashion for RobotUnitModule::ControlThread. More...
 
class RobotUnitModule::NJointControllerAttorneyForPublisher
 This class allows minimal access to private members of NJointControllerBase in a sane fashion for RobotUnitModule::Publisher. More...
 

Detailed Description

A high level controller writing its results into ControlTargets.

This is the abstract base class for all NJointControllers. It implements basic management routines required by the RobotUnit and some basic ice calls. NJointControllers are instantiated and managed by the RobotUnit.

A NJointControllerBase calculates ControlTargets for a set of ControlDevices in a specific ControlMode. This ControlMode is defined for each ControlDevice during construction.

Requested and Active

A NJointControllerBase can is requested / not requested and active / inactive. All four combinations are possible.

Requested / Not Requested

If the user wants this NJointControllerBase to be executed it is in a requested state (see isControllerRequested). Otherwise the controler is not requested.

Calling activateController sets the state to requested. Calling deactivateController sets the state to not requested. If the NJointControllerBase causes an error or a different NJointControllerBase using one or more of the same ControlDevice's is requested, this NJointControllerBase is deactivated.

Active / Inactive

Is the NJointControllerBase executed by the ControlThread it is active (see isControllerActive).

To be executed by the ControlThread, the NJointControllerBase has to be requested at some point in the past.

If a controller is active, it has to write a valid ControlTarget for each of its ControlDevicea (if it fails, it will be deactivated).

Constructor

In the Constructor, a NJointControllerBase has to declare all ControlDevices it uses.

The constructor takes a pointer to a configuration structure of the type NJointControllerBase::ConfigPtrT. If an implementation requires a special configuration structure (e.g.: SomeOtherCfg), it has to override this type by calling adding

using ConfigPtrT = SomeOtherCfgPtr;

to it's clas definition. The type SomeOtherCfg has to derive NJointControllerConfigPtr.

There is a way to generate a small gui widget for controller construction (see this section).

Using ControlTargets

A NJointControllerBase can use peekControlDevice to examine a ControlDevice before using it (e.g.: checking the supported ControlTargets).

If a ControlDevice should be used by this NJointControllerBase, it has to call useControlDevice. This sets the ControlMode for the ControlDevice and returns a pointer to the ControlTarget. This pointer has to be used to send commands in each iteration of rtRun. The ControlMode can't be changed afterwards (A new NJointControllerBase has to be created).

Using SensorValues

A NJointControllerBase can use peekSensorDevice to examine a SensorDevice before using it.

If a SensorDevice should be used by this NJointControllerBase, it has to call useSensorDevice. This returns a pointer to the SensorValue.

A synchronized Virtualrobot

If the controller needs a simox robot in rtRun, it should call useSynchronizedRtRobot. This will provide a simoxRobot via rtGetRobot. This robot is synchronized with the real robots state before calling rtRun

Rt and non Rt

Each NJointControllerBase has two parts:

  • The RT controll loop
  • The NonRT ice communication

The Rt controll loop (\ref rtRun)

Warning
This part has to satisfy realtime conditions! All realtime functions of NJointControllerBase have the 'rt' prefix.

Here the NJointControllerBase has access to the robot's current state and has to write results into ControlTargets.

It must not:

  • call any blocking operation
  • allocate ram on the heap (since this is a blocking operation)
  • resize any datastructure (e.g. vector::resize) (this sometimes allocates ram on the heap)
  • insert new datafields into datastructures (e.g. vector::push_back) (this sometimes allocates ram on the heap)
  • write to any stream (e.g. ARMARX_VERBOSE, std::cout, print, filestreams) (this sometimes blocks/allocates ram on the heap)
  • make network calls (e.g. through ice) (this blocks/allocates ram on the heap) (using begin_... end_... version of ice calls IS NO SOLUTION)
  • do any expensive calculations (e.g. calculate IK, run some solver, invert big matrices)

The NonRT ice communication

This part consits of any ice communication. Here the NJointControllerBase can get new controll parameters or targets from other components.

Communication between RT and NonRT

All communication between RT and NonRT has to be lockfree. The NJointControllerBase has to use constructs like atomics or TripleBuffers (See armarx::NJointControllerWithTripleBuffer).

General Dataflow in a NJointControllerBase
Dataflow in a NJointControllerBase using atomics for communication between RT and NonRT
Dataflow in a NJointControllerBase using a triple buffer for communication between RT and NonRT
Dataflow in a NJointControllerBase as a Graph of the two participating domains

The above image shows the two participating domains: one RT thread and multiple ICE threads. If data has to flow along an arrow, you need some construct for non blocking message passing.

Warning
If you use TrippleBuffers or WriteBufferedTrippleBuffers you need a separate one for each arrow.

How to do expensive calculations

You have to execute expensive calculations in a different worker thread. This thread could calculate target values at its own speed (e.g. 100 Hz).

While rtRun runs at a higher frequency (e.g. 1000 Hz) and:

  • reads target values
  • optionally passes the target values to a PID controller
  • writes them to the targets
  • sends the sensor values to the worker thread.

If you do some additional calculation in rtRun, you maybe need to pass config parameters from NonRT to RT using a nonblocking method.

Dataflow in a NJointControllerBase using a worker thread
Dataflow in a NJointControllerBase using a worker thread as a Graph of the three participating domains

The above image shows the three participating domains: one RT thread, one worker trhead and multiple ICE threads. If data has to flow along an arrow, you need some construct for non blocking message passing.

Warning
If you use TrippleBuffers or WriteBufferedTrippleBuffers you need a separate one for each arrow.

Providing a gui for controller construction.

By implementing these functions:

static WidgetDescription::WidgetPtr GenerateConfigDescription
(
const VirtualRobot::RobotPtr& robot,
const std::map<std::string, ConstControlDevicePtr>& controlDevices,
const std::map<std::string, ConstSensorDevicePtr>& sensorDevices
); //describes how the widget is supposed to look
static ConfigPtrT GenerateConfigFromVariants(const StringVariantBaseMap&); // turns the resulting variants into a config

The RobotUnitGui will provide a widget to configure and construct a NJointControllerBase of this type.

Examples

More examples can be found in the Tutorials Package

A simple pass Position controller

Note
The code can be found in the Tutorial package

Header

Include headers

Open the namespace

namespace armarx
{

Typedef some pointers

TYPEDEF_PTRS_HANDLE(NJointPositionPassThroughController);
TYPEDEF_PTRS_HANDLE(NJointPositionPassThroughControllerConfig);

The config has to inherit NJointControllerConfig and consists only of the joint name

class NJointPositionPassThroughControllerConfig : virtual public NJointControllerConfig
{
public:
NJointPositionPassThroughControllerConfig(const std::string& name): deviceName {name} {}
std::string deviceName;
};

The controller class has to inherit NJointControllerBase

class NJointPositionPassThroughController: public NJointControllerBase
{
public:

The NJointControllerBase provides a config widget for the RobotUnitGuiPlugin

static WidgetDescription::WidgetPtr GenerateConfigDescription
(
const std::map<std::string, ConstControlDevicePtr>& controlDevices,
const std::map<std::string, ConstSensorDevicePtr>& sensorDevices
);
static NJointControllerConfigPtr GenerateConfigFromVariants(const StringVariantBaseMap& values);

The ctor receives a pointer to the RobotUnit, a pointer to the config and a pointer to a VirtualRobot model.

NJointPositionPassThroughController(
const RobotUnitPtr& prov,
NJointControllerConfigPtr config,
);

The function to provide the class name.

std::string getClassName(const Ice::Current&) const override;

This controller provides widgets for function calls.

void callDescribedFunction(const std::string& name, const StringVariantBaseMap& value, const Ice::Current&) override;

The run function executed to calculate new targets

void rtRun(const IceUtil::Time& sensorValuesTimestamp, const IceUtil::Time& timeSinceLastIteration) override;

Hooks for this NJointControllerBase to execute code during publishing.

This NJointControllerBase uses one position SensorValue, calculates one position ControlTarget and stores the current position target and position value in atomics.

const SensorValue1DoFActuatorPosition* sensor;
ControlTarget1DoFActuatorPosition* target;
std::atomic<float> targetPos {0};
std::atomic<float> currentPos {0};

Close the class and the namespace

};
}

Source file

Include the required headers.

#include "NJointPositionPassThroughController.h"

Open the namespace

namespace armarx
{

This generates a config widget used to display a config gui in RobotUnitGui. It consist out of a HBoxLayout containing a Label and a StringComboBox

WidgetDescription::WidgetPtr NJointPositionPassThroughController::GenerateConfigDescription(const VirtualRobot::RobotPtr&, const std::map<std::string, ConstControlDevicePtr>& controlDevices, const std::map<std::string, ConstSensorDevicePtr>& sensorDevices)
{
using namespace armarx::WidgetDescription;
HBoxLayoutPtr layout = new HBoxLayout;
LabelPtr label = new Label;
label->text = "control device name";
layout->children.emplace_back(label);
StringComboBoxPtr box = new StringComboBox;
box->defaultIndex = 0;

The StringComboBox only contains the names of ControlDevices accepting a position ControlTarget and providing a position SensorValue

//filter control devices
for (const auto& name2dev : controlDevices)
{
const ConstControlDevicePtr& dev = name2dev.second;
const auto& name = name2dev.first;
if (
dev->hasJointController(ControlModes::Position1DoF) &&
dev->getJointController(ControlModes::Position1DoF)->getControlTarget()->isA<ControlTarget1DoFActuatorPosition>() &&
sensorDevices.count(name) &&
sensorDevices.at(name)->getSensorValue()->isA<SensorValue1DoFActuatorPosition>()
)
{
box->options.emplace_back(name);
}
}
box->name = "name";
layout->children.emplace_back(box);
return layout;
}

This turns a map of variants into the config required by this NJointControllerBase. The Variant for the key 'name' defines the ControlDevice.

NJointControllerConfigPtr NJointPositionPassThroughController::GenerateConfigFromVariants(const StringVariantBaseMap& values)
{
//you should check here for types null additional params etc
return new NJointPositionPassThroughControllerConfig {values.at("name")->getString()};
}

The constructors implementation.

NJointPositionPassThroughController::NJointPositionPassThroughController(
const RobotUnitPtr& ru,
NJointControllerConfigPtr config,
)
{

It checks whether the provided config has the correct type.

NJointPositionPassThroughControllerConfigPtr cfg = NJointPositionPassThroughControllerConfigPtr::dynamicCast(config);
ARMARX_CHECK_EXPRESSION(cfg) << "The provided config has the wrong type! The type is " << config->ice_id();

Then it retrieves the SensorValue and ControlTarget, casts then to the required types and stores them to the member variables.

const SensorValueBase* sv = useSensorValue(cfg->deviceName);
ControlTargetBase* ct = useControlTarget(cfg->deviceName, ControlModes::Position1DoF);
ARMARX_CHECK_EXPRESSION(sv->asA<SensorValue1DoFActuatorPosition>());
ARMARX_CHECK_EXPRESSION(ct->asA<ControlTarget1DoFActuatorPosition>());
sensor = sv->asA<SensorValue1DoFActuatorPosition>();
target = ct->asA<ControlTarget1DoFActuatorPosition>();
}

The class name has to be unique, hence the c++ class name should be used.

std::string NJointPositionPassThroughController::getClassName(const Ice::Current&) const
{
return "NJointPositionPassThroughController";
}

This NJointControllerBase provides two widgets for function calls.

WidgetDescription::StringWidgetDictionary NJointPositionPassThroughController::getFunctionDescriptions(const Ice::Current&) const
{
using namespace armarx::WidgetDescription;

The first widget has a Label and a FloatSpinBox.

HBoxLayoutPtr layoutSetPos = new HBoxLayout;
{
LabelPtr label = new Label;
label->text = "positiontarget";
layoutSetPos->children.emplace_back(label);
FloatSpinBoxPtr spin = new FloatSpinBox;
spin->defaultValue = 0;
spin->max = 1;
spin->min = -1;

The FloatSpinBox creates a variant called 'spinmearound'

spin->name = "spinmearound";
layoutSetPos->children.emplace_back(spin);
}

The second widget also has a Label and a FloatSpinBox.

VBoxLayoutPtr layoutSetHalfPos = new VBoxLayout;
{
LabelPtr label = new Label;
label->text = "positiontarget / 2";
layoutSetHalfPos->children.emplace_back(label);
FloatSpinBoxPtr spin = new FloatSpinBox;
spin->defaultValue = 0;
spin->max = 0.5;
spin->min = -0.5;
spin->name = "spinmehalfaround";
layoutSetHalfPos->children.emplace_back(spin);
}

This returns a map of boths widgets. The keys will be used to identify the called function.

return {{"SetPosition", layoutSetPos}, {"SetPositionHalf", layoutSetHalfPos}};
}

This function is called from the RobotUnitGuiPlugin when the prior defined functions are called. Both functions set the target position.

void NJointPositionPassThroughController::callDescribedFunction(const std::string& name, const StringVariantBaseMap& value, const Ice::Current&)
{
if (name == "SetPosition")
{
//you should check here for types null additional params etc
targetPos = value.at("spinmearound")->getFloat();
}
else if (name == "SetPositionHalf")
{
//you should check here for types null additional params etc
targetPos = value.at("spinmehalfaround")->getFloat() * 2;
}
else
{
ARMARX_ERROR << "CALLED UNKNOWN REMOTE FUNCTION: " << name;
}
}

The rtRun function sets the ControlTarget to the target value set via the atomic and stores the current SensorValue to the other atomic.

void NJointPositionPassThroughController::rtRun(const IceUtil::Time& t, const IceUtil::Time&)
{
ARMARX_RT_LOGF_ERROR("A MESSAGE PARAMETER %f", t.toSecondsDouble()).deactivateSpam(1);
ARMARX_RT_LOGF_IMPORTANT("A MESSAGE WITHOUT PARAMETERS").deactivateSpam(1);
target->position = targetPos;
currentPos = sensor->position;
}

The publish activation hook does nothing, but could be used to call DebugDraver::setRobotVisu.

void NJointPositionPassThroughController::onPublishActivation(const DebugDrawerInterfacePrx&, const DebugObserverInterfacePrx&)
{
//we could do some setup for the drawer here. e.g. add a robot
}

The publish deactivation hook clears the DebugDrawer layer

void NJointPositionPassThroughController::onPublishDeactivation(const DebugDrawerInterfacePrx& drawer, const DebugObserverInterfacePrx&)
{
drawer->removeLayer("Layer_" + getInstanceName());
}

The publish hook draws a sphere with radius of the position stored in the atomic times 2000 to the DebugDrawer.

void NJointPositionPassThroughController::onPublish(const SensorAndControl&, const DebugDrawerInterfacePrx& drawer, const DebugObserverInterfacePrx&)
{
drawer->setSphereVisu("Layer_" + getInstanceName(), "positionball", new Vector3, armarx::DrawColor {1, 1, 1, 1}, currentPos * 2000);
}

This registers a factory for this NJointControllerBase. This factory is used by the RobotUnit to create the NJointControllerBase. The passed name has to match the name returned by getClassName.

NJointControllerRegistration<NJointPositionPassThroughController> registrationControllerNJointPositionPassThroughController("NJointPositionPassThroughController");

This statically asserts a factory for the type NJointPositionPassThroughController is present.

ARMARX_ASSERT_NJOINTCONTROLLER_HAS_CONSTRUCTION_GUI(NJointPositionPassThroughController);

Close the namespace

}

Definition at line 578 of file NJointControllerBase.h.

Member Typedef Documentation

◆ ConfigPtrT

using ConfigPtrT = NJointControllerConfigPtr

Definition at line 586 of file NJointControllerBase.h.

◆ GenerateConfigDescriptionFunctionSignature

using GenerateConfigDescriptionFunctionSignature = WidgetDescription::WidgetPtr (*)( const VirtualRobot::RobotPtr&, const std::map<std::string, ConstControlDevicePtr>& controlDevices, const std::map<std::string, ConstSensorDevicePtr>& sensorDevices)

Definition at line 590 of file NJointControllerBase.h.

◆ GenerateConfigFromVariantsFunctionSignature

Definition at line 593 of file NJointControllerBase.h.

Constructor & Destructor Documentation

◆ NJointControllerBase()

Definition at line 398 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ ~NJointControllerBase()

~NJointControllerBase ( )
override

Definition at line 405 of file NJointController.cpp.

Member Function Documentation

◆ activateController()

void activateController ( const Ice::Current &  = Ice::emptyCurrent)
finaloverride

Definition at line 143 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ AreNotInConflict()

static std::optional<std::vector<char> > AreNotInConflict ( ItT  first,
ItT  last 
)
inlinestatic

Definition at line 1036 of file NJointControllerBase.h.

+ Here is the caller graph for this function:

◆ callDescribedFunction()

void callDescribedFunction ( const std::string &  ,
const StringVariantBaseMap ,
const Ice::Current &  = Ice::emptyCurrent 
)
inlineoverride

Definition at line 828 of file NJointControllerBase.h.

◆ deactivateAndDeleteController()

void deactivateAndDeleteController ( const Ice::Current &  = Ice::emptyCurrent)
finaloverride

Definition at line 161 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ deactivateController()

void deactivateController ( const Ice::Current &  = Ice::emptyCurrent)
finaloverride

Definition at line 149 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ deleteController()

void deleteController ( const Ice::Current &  = Ice::emptyCurrent)
finaloverride

Definition at line 155 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ getClassName()

std::string getClassName ( const Ice::Current &  = Ice::emptyCurrent) const
overridepure virtual

Implemented in Controller, Controller, Controller, Controller, NJointTaskspaceSafetyImpedanceController, NJointBiKAC, NJointHolonomicPlatformGlobalPositionController, NJointTaskspaceMixedImpedanceVelocityController, NJointTaskspaceAdmittanceController, NJointTaskspaceImpedanceController, NJointTaskspaceVelocityController, NJointHolonomicPlatformRelativePositionController, NJointHolonomicPlatformVelocityControllerWithRamp, NJointKinematicUnitPassThroughController, NJointTaskspaceCollisionAvoidanceImpedanceController, NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController, NJointHolonomicPlatformUnitVelocityPassThroughController, NJointTSAdmittanceMPController, NJointTSCollisionAvoidanceImpedanceMPController, NJointTSCollisionAvoidanceMixedImpedanceVelocityMPController, NJointTSImpedanceMPController, NJointTSMixedImpedanceVelocityMPController, NJointTSSafetyImpedanceMPController, NJointTSVelocityMPController, NJointCartesianNaturalPositionController, NJointCartesianWaypointController, NJointCartesianVelocityControllerWithRamp, NJointTaskspaceZeroTorqueOrVelocityController, NJointZeroTorqueOrVelocityWithFTController, NJointKVILImpedanceMPController, NJointCartesianTorqueController, NJointCartesianVelocityController, NJointTCPController, NJointTSDMPController, KeypointMPController, DeprecatedNJointTSDMPController, NJointCCDMPController, NJointBimanualCCDMPVelocityController, NJointKeypointsImpedanceController, NJointTaskSpaceImpedanceController, NJointBimanualCCDMPController, NJointKeypointsAdmittanceController, NJointTaskSpaceImpedanceDMPController, NJointKeypointsImpedanceMPController, NJointBimanualForceMPController, NJointKeypointsAdmittanceMPController, DeprecatedNJointTaskSpaceAdmittanceDMPController, DeprecatedNJointTaskSpaceImpedanceDMPController, NJointJointSpaceDMPController, NJointJSDMPController, NJointTrajectoryController, NJointBimanualCartesianAdmittanceController, NJointZeroTorqueController, NJointZeroTorqueOrVelocityController, NJointTorqueController, DSRTController, DSRTBimanualController, DSJointCarryController, NJointBimanualForceController, NJointBimanualObjLevelMultiMPController, NJointTaskSpaceAdaptiveDMPController, DeprecatedNJointPeriodicTSDMPCompliantController, NJointPeriodicTSDMPCompliantController, NJointAdaptiveWipingController, NJointAnomalyDetectionAdaptiveWipingController, NJointPeriodicTSDMPForwardVelController, NJointBimanualCCDMPController, NJointBimanualObjLevelController, and NJointBimanualObjLevelVelController.

+ Here is the caller graph for this function:

◆ getControlDevicesUsedJointController()

const std::map<std::string, const JointController*>& getControlDevicesUsedJointController ( )
inline

Definition at line 1020 of file NJointControllerBase.h.

◆ getControlDeviceUsedBitmap()

const std::vector<char>& getControlDeviceUsedBitmap ( ) const
inline

Definition at line 1008 of file NJointControllerBase.h.

◆ getControlDeviceUsedControlModeMap()

StringStringDictionary getControlDeviceUsedControlModeMap ( const Ice::Current &  = Ice::emptyCurrent) const
inlinefinaloverride

Definition at line 1001 of file NJointControllerBase.h.

◆ getControlDeviceUsedIndices()

const std::vector<std::size_t>& getControlDeviceUsedIndices ( ) const
inline

Definition at line 1014 of file NJointControllerBase.h.

◆ getControllerDescription()

NJointControllerDescription getControllerDescription ( const Ice::Current &  = Ice::emptyCurrent) const
finaloverride

Definition at line 79 of file NJointController.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getControllerDescriptionWithStatus()

NJointControllerDescriptionWithStatus getControllerDescriptionWithStatus ( const Ice::Current &  = Ice::emptyCurrent) const
finaloverride

Definition at line 129 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ getControllerStatus()

NJointControllerStatus getControllerStatus ( const Ice::Current &  = Ice::emptyCurrent) const
finaloverride

Definition at line 114 of file NJointController.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultName()

std::string getDefaultName ( ) const
inlineoverrideprotectedvirtual
See also
Component::getDefaultName

Implements ManagedIceObject.

Definition at line 683 of file NJointControllerBase.h.

+ Here is the call graph for this function:

◆ getFunctionDescriptions()

WidgetDescription::StringWidgetDictionary getFunctionDescriptions ( const Ice::Current &  = Ice::emptyCurrent) const
inlineoverride

Definition at line 822 of file NJointControllerBase.h.

◆ getInstanceName()

std::string getInstanceName ( const Ice::Current &  = Ice::emptyCurrent) const
inlinefinaloverride

Definition at line 803 of file NJointControllerBase.h.

+ Here is the caller graph for this function:

◆ getThreadPool()

ThreadPoolPtr getThreadPool ( ) const
protected

Definition at line 376 of file NJointController.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasControllerError()

bool hasControllerError ( const Ice::Current &  = Ice::emptyCurrent) const
inlinefinaloverride

Definition at line 795 of file NJointControllerBase.h.

◆ isControllerActive()

bool isControllerActive ( const Ice::Current &  = Ice::emptyCurrent) const
inlinefinaloverride

Definition at line 777 of file NJointControllerBase.h.

+ Here is the caller graph for this function:

◆ isControllerRequested()

bool isControllerRequested ( const Ice::Current &  = Ice::emptyCurrent) const
inlinefinaloverride

Definition at line 783 of file NJointControllerBase.h.

◆ isDeletable()

bool isDeletable ( const Ice::Current &  = Ice::emptyCurrent) const
inlinefinaloverride

Definition at line 789 of file NJointControllerBase.h.

◆ isNotInConflictWith() [1/2]

std::optional<std::vector<char> > isNotInConflictWith ( const NJointControllerBasePtr &  other) const
inline

Definition at line 1027 of file NJointControllerBase.h.

◆ isNotInConflictWith() [2/2]

std::optional< std::vector< char > > isNotInConflictWith ( const std::vector< char > &  used) const

Definition at line 94 of file NJointController.cpp.

◆ onConnectComponent()

void onConnectComponent ( )
finalprotectedvirtual
See also
Component::onConnectComponent

Implements ManagedIceObject.

Definition at line 312 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ onConnectNJointController()

virtual void onConnectNJointController ( )
inlineprotectedvirtual

Reimplemented in NJointTrajectoryController.

Definition at line 703 of file NJointControllerBase.h.

+ Here is the caller graph for this function:

◆ onDisconnectComponent()

void onDisconnectComponent ( )
finalprotectedvirtual
See also
Component::onDisconnectComponent

Reimplemented from ManagedIceObject.

Reimplemented in NJointBimanualCCDMPController.

Definition at line 319 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ onDisconnectNJointController()

◆ onExitComponent()

void onExitComponent ( )
finalprotectedvirtual
See also
Component::onExitComponent

Reimplemented from ManagedIceObject.

Definition at line 326 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ onExitNJointController()

virtual void onExitNJointController ( )
inlineprotectedvirtual

Definition at line 713 of file NJointControllerBase.h.

+ Here is the caller graph for this function:

◆ onInitComponent()

void onInitComponent ( )
finalprotectedvirtual
See also
Component::onInitComponent

Implements ManagedIceObject.

Reimplemented in NJointBimanualCCDMPController.

Definition at line 305 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ onInitNJointController()

◆ onPublish()

virtual void onPublish ( const SensorAndControl ,
const DebugDrawerInterfacePrx ,
const DebugObserverInterfacePrx  
)
inlineprotectedvirtual

Reimplemented in NJointTaskspaceCollisionAvoidanceImpedanceController, NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController, Controller, Controller, Controller, NJointTaskspaceSafetyImpedanceController, NJointTaskspaceMixedImpedanceVelocityController, NJointTaskspaceAdmittanceController, NJointTaskspaceImpedanceController, NJointTaskspaceVelocityController, DeprecatedNJointTSDMPController, NJointBiKAC, NJointTaskspaceZeroTorqueOrVelocityController, NJointTSDMPController, KeypointMPController, DeprecatedNJointTaskSpaceImpedanceDMPController, NJointTaskSpaceImpedanceDMPController, DeprecatedNJointTaskSpaceAdmittanceDMPController, NJointBimanualCCDMPVelocityController, NJointZeroTorqueOrVelocityWithFTController, NJointCCDMPController, NJointBimanualCCDMPController, NJointKeypointsAdmittanceController, NJointKeypointsImpedanceController, NJointBimanualForceMPController, NJointJointSpaceDMPController, NJointJSDMPController, NJointTaskSpaceImpedanceController, NJointCartesianWaypointController, NJointCartesianNaturalPositionController, DSRTBimanualController, DSRTController, DSJointCarryController, NJointBimanualObjLevelMultiMPController, NJointBimanualObjLevelController, NJointBimanualObjLevelVelController, NJointTaskSpaceAdaptiveDMPController, NJointBimanualCCDMPController, DeprecatedNJointPeriodicTSDMPCompliantController, NJointAnomalyDetectionAdaptiveWipingController, NJointBimanualForceController, NJointPeriodicTSDMPCompliantController, NJointAdaptiveWipingController, NJointPeriodicTSDMPForwardVelController, NJointBimanualCartesianAdmittanceController, and Controller.

Definition at line 1073 of file NJointControllerBase.h.

◆ onPublishActivation()

virtual void onPublishActivation ( const DebugDrawerInterfacePrx ,
const DebugObserverInterfacePrx  
)
inlineprotectedvirtual

Definition at line 1063 of file NJointControllerBase.h.

◆ onPublishDeactivation()

virtual void onPublishDeactivation ( const DebugDrawerInterfacePrx ,
const DebugObserverInterfacePrx  
)
inlineprotectedvirtual

Definition at line 1068 of file NJointControllerBase.h.

◆ peekControlDevice()

ConstControlDevicePtr peekControlDevice ( const std::string &  deviceName) const

Get a const ptr to the given ControlDevice.

Warning
This function can only be called in a NJointControllerBase's ctor (or functions called in it)
Parameters
deviceNameThe ControlDevice's name
Returns
A const ptr to the given ControlDevice

Definition at line 284 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ peekSensorDevice()

armarx::ConstSensorDevicePtr peekSensorDevice ( const std::string &  deviceName) const

Get a const ptr to the given SensorDevice.

Warning
This function can only be called in a NJointControllerBase's ctor (or functions called in it)
Parameters
deviceNameThe SensorDevice's name
Returns
A const ptr to the given SensorDevice

Definition at line 275 of file NJointController.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rtGetClassName()

const std::string& rtGetClassName ( ) const
inline

Returns the class name.

(the c-string may be used for rt message logging)

Returns
The class name. (the c-string may be used for rt message logging)

Definition at line 911 of file NJointControllerBase.h.

◆ rtGetControlDeviceUsedIndices()

const std::vector<std::size_t>& rtGetControlDeviceUsedIndices ( ) const
inline

Returns the indices of all ControlDevice's this NJointControllerBase calculates a ControlTarget for.

Returns
The indices of all ControlDevice's this NJointControllerBase calculates a ControlTarget for.

Definition at line 882 of file NJointControllerBase.h.

◆ rtGetErrorState()

bool rtGetErrorState ( ) const
inline

Sets the error state to true.

This will deactivate this controller!

Definition at line 891 of file NJointControllerBase.h.

◆ rtGetInstanceName()

const std::string& rtGetInstanceName ( ) const
inline

Returns the instance name.

(the c-string may be used for rt message logging)

Returns
The instance name. (the c-string may be used for rt message logging)

Definition at line 921 of file NJointControllerBase.h.

◆ rtGetNumberOfUsedControlDevices()

std::size_t rtGetNumberOfUsedControlDevices ( ) const
inline

Returns the number of used ControlDevices.

Returns
The number of used ControlDevices

Definition at line 901 of file NJointControllerBase.h.

◆ rtGetRobot()

const VirtualRobot::RobotPtr& rtGetRobot ( )
inline

TODO make protected and use attorneys.

Returns the virtual robot used by this NJointControllerBase in the rtRun

Returns
The virtual robot used by this NJointControllerBase in the rtRun
See also
useSynchronizedRtRobot
rtGetRobotNodes

Definition at line 845 of file NJointControllerBase.h.

◆ rtGetRobotNodes()

const std::vector<VirtualRobot::RobotNodePtr>& rtGetRobotNodes ( )
inline

Returns the nodes of the virtual robot used by this NJointControllerBase in the rtRun.

Returns
The nodes of the virtual robot used by this NJointControllerBase in the rtRun
See also
useSynchronizedRtRobot
rtGetRobot

Definition at line 857 of file NJointControllerBase.h.

◆ rtPostDeactivateController()

◆ rtPreActivateController()

virtual void rtPreActivateController ( )
inlineprotectedvirtual

This function is called before the controller is activated.

You can use it to activate a thread again (DO NOT SPAWN NEW THREADS!) e.g. via a std::atomic_bool.

Reimplemented in DeprecatedNJointTaskSpaceAdmittanceDMPController, NJointBimanualCCDMPVelocityController, NJointBimanualCCDMPController, Controller, NJointTaskspaceSafetyImpedanceController, NJointTaskspaceMixedImpedanceVelocityController, NJointTaskspaceAdmittanceController, NJointTaskspaceImpedanceController, NJointTaskspaceVelocityController, NJointTaskspaceZeroTorqueOrVelocityController, DeprecatedNJointTSDMPController, NJointCartesianVelocityControllerWithRamp, NJointTaskSpaceImpedanceController, Controller, Controller, NJointTSDMPController, NJointCartesianVelocityController, NJointKeypointsImpedanceController, Controller, NJointCartesianTorqueController, NJointZeroTorqueOrVelocityWithFTController, NJointTCPController, NJointKeypointsAdmittanceController, NJointTaskspaceCollisionAvoidanceImpedanceController, NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController, NJointHolonomicPlatformGlobalPositionController, NJointKVILImpedanceMPController, NJointHolonomicPlatformVelocityControllerWithRamp, NJointHolonomicPlatformRelativePositionController, NJointCCDMPController, NJointCartesianWaypointController, NJointCartesianNaturalPositionController, KeypointMPController, NJointJointSpaceDMPController, NJointJSDMPController, NJointKinematicUnitPassThroughController, NJointKeypointsImpedanceMPController, NJointKeypointsAdmittanceMPController, NJointZeroTorqueOrVelocityController, NJointZeroTorqueController, NJointTrajectoryController, NJointTorqueController, DSRTBimanualController, DSRTController, DSJointCarryController, NJointBimanualObjLevelController, NJointBimanualObjLevelMultiMPController, NJointBimanualCartesianAdmittanceController, DeprecatedNJointTaskSpaceImpedanceDMPController, NJointTaskSpaceImpedanceDMPController, NJointTaskSpaceAdaptiveDMPController, and NJointBimanualObjLevelVelController.

Definition at line 932 of file NJointControllerBase.h.

◆ rtSetErrorState()

void rtSetErrorState ( )
inlineprotected

Sets the error state to true.

This will deactivate this controller!

Definition at line 949 of file NJointControllerBase.h.

◆ rtUsesControlDevice()

bool rtUsesControlDevice ( std::size_t  deviceIndex) const
inline

Returns whether this NJointControllerBase calculates a ControlTarget for the given ControlDevice.

Parameters
deviceIndexThe ControlDevice's index
Returns
Whether this NJointControllerBase calculates a ControlTarget for the given ControlDevice

Definition at line 870 of file NJointControllerBase.h.

◆ runTask()

void runTask ( const std::string &  taskName,
Task &&  task 
)
inlineprotected

Executes a given task in a separate thread from the Application ThreadPool.

Parameters
taskNameDescriptive name of this task to identify it on errors.
taskstd::function object (or lambda) that is to be executed.
Note
This task will be joined in onExitComponent of the NJointControllerBase. So make sure it terminates, when the controller is deactivated or removed!
runTask("PlotterTask", [&]
{
CycleUtil c(30);
getObjectScheduler()->waitForObjectStateMinimum(eManagedIceObjectStarted);
while (getState() == eManagedIceObjectStarted)
{
{
for (size_t i = 0; i < sensors.size(); i++)
{
errors[cfg->jointNames.at(i)] = new Variant(currentError(i));
}
dbgObs->setDebugChannel("TrajectoryController", errors);
}
c.waitForCycleDuration();
}
});

Definition at line 753 of file NJointControllerBase.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ useControlTarget() [1/2]

ControlTargetBase * useControlTarget ( const std::string &  deviceName,
const std::string &  controlMode 
)

Declares to calculate the ControlTarget for the given ControlDevice in the given ControlMode when rtRun is called.

Warning
This function can only be called in a NJointControllerBase's ctor (or functions called in it)
Parameters
deviceNameThe ControlDevice's name
controlModeThe ControlTarget's ControlMode
Returns
A ptr to the given ControlDevice's ControlTargetin the given ControlMode

Definition at line 410 of file NJointController.cpp.

+ Here is the call graph for this function:

◆ useControlTarget() [2/2]

T* useControlTarget ( const std::string &  deviceName,
const std::string &  controlMode 
)
inline

Declares to calculate the ControlTarget for the given ControlDevice in the given ControlMode when rtRun is called.

Warning
This function can only be called in a NJointControllerBase's ctor (or functions called in it)
Parameters
deviceNameThe ControlDevice's name
controlModeThe ControlTarget's ControlMode
Returns
A ptr to the given ControlDevice's ControlTargetin the given ControlMode

Definition at line 634 of file NJointControllerBase.h.

+ Here is the call graph for this function:

◆ useSensorValue() [1/2]

const T* useSensorValue ( const std::string &  deviceName) const
inline

Get a const ptr to the given SensorDevice's SensorValue.

Warning
This function can only be called in a NJointControllerBase's ctor (or functions called in it)
Parameters
deviceNameThe SensorDevice's name
Returns
A const ptr to the given SensorDevice's SensorValue

Definition at line 658 of file NJointControllerBase.h.

+ Here is the call graph for this function:

◆ useSensorValue() [2/2]

const SensorValueBase * useSensorValue ( const std::string &  sensorDeviceName) const

Get a const ptr to the given SensorDevice's SensorValue.

Warning
This function can only be called in a NJointControllerBase's ctor (or functions called in it)
Parameters
deviceNameThe SensorDevice's name
Returns
A const ptr to the given SensorDevice's SensorValue

Definition at line 383 of file NJointController.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ useSynchronizedRtRobot()

const VirtualRobot::RobotPtr & useSynchronizedRtRobot ( bool  updateCollisionModel = false)

Requests a VirtualRobot for use in rtRun *.

Warning
This function can only be called in a NJointControllerBase's ctor (or functions called in it)

The robot is updated before rtRun is called and can be accessed via \rtGetRobot

Parameters
updateCollisionModelWhether the robot's collision model should be updated
See also
rtGetRobot

Definition at line 293 of file NJointController.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ detail::NJointControllerRegistryEntryHelper

This is required for the factory.

Warning
!! DO NOT ADD ADDITIONAL FRIENDS IF YOU DO NOT KNOW WAHT YOU ARE DOING! IF YOU DO SOMETHING WRONG YOU WILL CAUSE UNDEFINED BEHAVIOUR !!

Definition at line 1142 of file NJointControllerBase.h.

◆ RobotUnitModule::NJointControllerAttorneyForControllerManagement

This class allows minimal access to private members of NJointControllerBase in a sane fashion for RobotUnitModule::ControllerManagement.

Warning
!! DO NOT ADD ADDITIONAL FRIENDS IF YOU DO NOT KNOW WAHT YOU ARE DOING! IF YOU DO SOMETHING WRONG YOU WILL CAUSE UNDEFINED BEHAVIOUR !!

Definition at line 1126 of file NJointControllerBase.h.

◆ RobotUnitModule::NJointControllerAttorneyForControlThread

This class allows minimal access to private members of NJointControllerBase in a sane fashion for RobotUnitModule::ControlThread.

Warning
!! DO NOT ADD ADDITIONAL FRIENDS IF YOU DO NOT KNOW WAHT YOU ARE DOING! IF YOU DO SOMETHING WRONG YOU WILL CAUSE UNDEFINED BEHAVIOUR !!

Definition at line 1131 of file NJointControllerBase.h.

◆ RobotUnitModule::NJointControllerAttorneyForPublisher

This class allows minimal access to private members of NJointControllerBase in a sane fashion for RobotUnitModule::Publisher.

Warning
!! DO NOT ADD ADDITIONAL FRIENDS IF YOU DO NOT KNOW WAHT YOU ARE DOING! IF YOU DO SOMETHING WRONG YOU WILL CAUSE UNDEFINED BEHAVIOUR !!

Definition at line 1136 of file NJointControllerBase.h.

Member Data Documentation

◆ NullPtr

const NJointControllerBasePtr NullPtr {nullptr}
static

Definition at line 987 of file NJointControllerBase.h.

◆ threadHandles

std::map<std::string, std::shared_ptr<ThreadPool::Handle> > threadHandles
protected

Definition at line 769 of file NJointControllerBase.h.

◆ threadHandlesMutex

std::mutex threadHandlesMutex
protected

Definition at line 770 of file NJointControllerBase.h.


The documentation for this class was generated from the following files:
armarx::NJointControllerBase::getInstanceName
std::string getInstanceName(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: NJointControllerBase.h:803
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
armarx::TYPEDEF_PTRS_HANDLE
TYPEDEF_PTRS_HANDLE(NJointCartesianNaturalPositionController)
RobotUnit.h
armarx::WidgetDescription::StringWidgetDictionary
::std::map<::std::string, ::armarx::WidgetDescription::WidgetPtr > StringWidgetDictionary
Definition: NJointControllerBase.h:69
armarx::NJointControllerBase::useControlTarget
ControlTargetBase * useControlTarget(const std::string &deviceName, const std::string &controlMode)
Declares to calculate the ControlTarget for the given ControlDevice in the given ControlMode when rtR...
Definition: NJointController.cpp:410
Pose.h
armarx::NJointControllerBase::getClassName
std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override=0
boost::target
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:688
armarx::ManagedIceObject::getState
int getState() const
Retrieve current state of the ManagedIceObject.
Definition: ManagedIceObject.cpp:725
armarx::DebugObserverInterfacePrx
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
Definition: JointController.h:44
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::NJointControllerBase::onPublishDeactivation
virtual void onPublishDeactivation(const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &)
Definition: NJointControllerBase.h:1068
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:586
armarx::NJointControllerBase::callDescribedFunction
void callDescribedFunction(const std::string &, const StringVariantBaseMap &, const Ice::Current &=Ice::emptyCurrent) override
Definition: NJointControllerBase.h:828
ARMARX_ASSERT_NJOINTCONTROLLER_HAS_CONSTRUCTION_GUI
#define ARMARX_ASSERT_NJOINTCONTROLLER_HAS_CONSTRUCTION_GUI(T)
Definition: NJointControllerRegistry.h:242
armarx::SensorAndControl
detail::ControlThreadOutputBufferEntry SensorAndControl
Definition: NJointControllerBase.h:72
armarx::NJointControllerBase::onPublishActivation
virtual void onPublishActivation(const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &)
Definition: NJointControllerBase.h:1063
visionx::voxelgrid::Label
uint32_t Label
Type of an object label.
Definition: types.h:7
armarx::WidgetDescription
Definition: DefaultWidgetDescriptions.cpp:27
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::NJointControllerBase::isControllerActive
bool isControllerActive(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: NJointControllerBase.h:777
armarx::NJointControllerBase::runTask
void runTask(const std::string &taskName, Task &&task)
Executes a given task in a separate thread from the Application ThreadPool.
Definition: NJointControllerBase.h:753
armarx::NJointControllerBase::getFunctionDescriptions
WidgetDescription::StringWidgetDictionary getFunctionDescriptions(const Ice::Current &=Ice::emptyCurrent) const override
Definition: NJointControllerBase.h:822
armarx::NJointControllerBase::onPublish
virtual void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &)
Definition: NJointControllerBase.h:1073
ControlTarget1DoFActuator.h
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
ARMARX_RT_LOGF_IMPORTANT
#define ARMARX_RT_LOGF_IMPORTANT(...)
Definition: ControlThreadOutputBuffer.h:341
ARMARX_RT_LOGF_ERROR
#define ARMARX_RT_LOGF_ERROR(...)
Definition: ControlThreadOutputBuffer.h:347
armarx::NJointControllerBase::NJointControllerBase
NJointControllerBase()
Definition: NJointController.cpp:398
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::WidgetDescription::WidgetPtr
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
Definition: NJointControllerBase.h:66
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
memoryx::KBM::Vector3
Eigen::Vector3d Vector3
Definition: kbm.h:41
armarx::DebugDrawerInterfacePrx
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
Definition: JointController.h:40
armarx::ConstControlDevicePtr
std::shared_ptr< const class ControlDevice > ConstControlDevicePtr
Definition: NJointControllerBase.h:76
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ManagedIceObject::getObjectScheduler
ArmarXObjectSchedulerPtr getObjectScheduler() const
Definition: ManagedIceObject.cpp:731
SensorValue1DoFActuator.h
armarx::NJointControllerBase::useSensorValue
const SensorValueBase * useSensorValue(const std::string &sensorDeviceName) const
Get a const ptr to the given SensorDevice's SensorValue.
Definition: NJointController.cpp:383
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18