186 virtual public RobotUnitSimulationSinterface
190 torquesTB{&cvGotSensorData},
191 anglesTB{&cvGotSensorData},
192 velocitiesTB{&cvGotSensorData},
193 robPoseTB{&cvGotSensorData},
194 robVelTB{&cvGotSensorData},
195 forceTorqueTB{&cvGotSensorData}
205 return "RobotUnitSimulation";
244 const Ice::Current& = Ice::emptyCurrent)
override;
247 void updateForceTorque(ForceTorqueData
const& ftData, IceUtil::Time
timestamp);
249 const NameValueMap& nv,
250 const std::string name)
const;
251 void rtUpdateSensors(
bool wait);
252 void rtSendCommands();
254 bool skipReport()
const;
257 getMappedFTName(
const std::string& name)
const
259 return ftMappings.count(name) ? ftMappings.at(name).sensorName : name;
263 getMappedFTReportingFrame(
const std::string& name,
const std::string& unmappedFrame)
const
265 return ftMappings.count(name) ? ftMappings.at(name).reportFrame : unmappedFrame;
269 getMappedFTReportingTransformation(
const std::string& name)
const
271 return ftMappings.count(name) ? ftMappings.at(name).reportTransformation
272 : Eigen::Matrix3f::Identity();
275 void rtPollRobotState();
276 std::atomic_bool isPolling{
false};
280 Eigen::Vector3f lin{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
281 Eigen::Vector3f ang{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
286 Eigen::Vector3f force{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
287 Eigen::Vector3f torque{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
293 std::condition_variable cvGotSensorData;
294 std::atomic<bool> gotSensorData{
false};
295 IceUtil::Time sensorValuesTimestamp;
297 KeyValueVector<std::string, JointSimulationDevicePtr> jointDevs;
298 TripleBufferWithGuardAndTime<std::vector<float>> torquesTB;
299 TripleBufferWithGuardAndTime<std::vector<float>> anglesTB;
300 TripleBufferWithGuardAndTime<std::vector<float>> velocitiesTB;
305 PlatformSimulationDevicePtr platformDev;
307 TripleBufferWithGuardAndTime<Eigen::Matrix4f> robPoseTB;
308 TripleBufferWithGuardAndTime<RobVel> robVelTB;
310 KeyValueVector<std::string, ForceTorqueSimulationSensorDevicePtr> forceTorqueDevs;
311 TripleBufferWithGuardAndTime<std::vector<FT>> forceTorqueTB;
312 std::vector<AtomicWrapper<std::uintmax_t>> forceTorqueTimes;
316 std::string sensorName;
317 std::string originalReportFrame;
318 std::string reportFrame;
319 Eigen::Matrix3f reportTransformation;
322 std::map<std::string, FTMappingData> ftMappings;
330 std::atomic_bool synchronizedSimulation;
331 IceUtil::Time controlIterationMs;
332 std::string simulatorRobotListenerInterfaceTopic;
333 std::string simulatorForceTorqueListenerInterfaceTopic;
335 std::atomic<std::uintmax_t> iterationCount{0};
342 return controlIterationMs;