30 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
32 #include <RobotComponents/interface/components/ViconMarkerProviderInterface.h>
33 #include <RobotComponents/interface/components/DHParameterOptimizationLoggerInterface.h>
50 defineOptionalProperty<std::string>(
"ViconDataTopicName",
"ViconDataUpdates",
"Topic on which the marker data is published by the ViconMarkerProvider");
51 defineOptionalProperty<std::string>(
"RobotStateComponentName",
"RobotStateComponent");
52 defineOptionalProperty<std::string>(
"RobotUnitObserverName",
"RobotUnitObserver",
"Name of the RobotUnitObserver");
53 defineOptionalProperty<std::string>(
"LoggingFilePath",
"~/home/DHLogging",
"Path to the logging file");
54 defineOptionalProperty<std::string>(
"DebugObserverTopicName",
"DebugObserver",
"The topic where updates are send to");
55 defineOptionalProperty<int>(
"FilterWindowSize", 100,
"Window size of average filter applied to vicon marker positions.");
56 defineRequiredProperty<std::string>(
"Neck_ViconObjectName",
"Name of the object for the neck marker that is used in the vicon system. "
57 "This is needed to parse the data received from the vicon system correctly.");
58 defineRequiredProperty<std::string>(
"Hand_ViconObjectName",
"Name of the object for the hand marker that is used in the vicon system. "
59 "This is needed to parse the data received from the vicon system correctly.");
76 virtual public DHParameterOptimizationLoggerInterface
84 return "DHParameterOptimizationLogger";
91 void logData(
const Ice::Current& = Ice::emptyCurrent)
override;
95 void init(
const std::string& kinematicChainName,
96 const std::map<std::string, std::string>& neckMarkerMapping,
97 const std::map<std::string, std::string>& handMarkerMapping,
98 const std::string& loggingFileName,
99 bool logRepeatAccuracy,
100 const Ice::Current& = Ice::emptyCurrent)
override;
134 ObserverInterfacePrx robotUnitObserver;
138 std::string _filePath;
139 void setupFile(
const std::string& fileName);
144 StringVector3fMap _viconMarkerBuffer;
145 bool _viconBufferUpdated;
146 StringVector3fMap _filteredViconMarkerPositions_robotRootFrame;
147 bool _filteredViconMarkerPositionsUpdated;
149 mutable std::mutex _bufferMutex;
150 bool _viconLoggingActive;
154 void logViconMarkerPositions(std::vector<float>&
data);
155 void logJointValues(std::vector<float>&
data)
const;
156 void logForwardKinematicToViconMarker(std::vector<float>&
data)
const;
157 void logErrorBetweenModelAndVicon(std::vector<float>&
data);
158 void logRawTorqueTicks(std::vector<float>&
data)
const;
159 void logTorqueValues(std::vector<float>&
data)
const;
161 void logFTSensorValues(std::vector<float>&
data)
const;
163 StringVector3fMap waitBlockingForAllMarkersFiltered();
166 VirtualRobot::RobotNodeSetPtr _kc;
167 NameList _jointNames;
168 NameList _neckMarker;
169 NameList _handMarker;
170 std::map<std::string, std::string> _neckMarkerMapping;
171 std::map<std::string, std::string> _handMarkerMapping;
172 VirtualRobot::RobotNodePtr getNeckMarkerRootNode()
const;
173 VirtualRobot::RobotNodePtr getHandMarkerRootNode()
const;
174 std::string _viconObjectName_neck;
175 std::string _viconObjectName_hand;
177 bool _logRepeatAccuracy;
180 bool _observedHandPosesUpdated;
181 std::pair<float, float> calculateRepeatError();
183 Eigen::Matrix4f registration3d(
const Eigen::MatrixXf& matrixA,
const Eigen::MatrixXf& matrixB)
const;
184 StringVector3fMap transformViconMarkerPositionsIntoRobotRootFrame(
const StringVector3fMap&
values)
const;