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";
250 const Ice::Current& = Ice::emptyCurrent)
override;
253 void updateForceTorque(ForceTorqueData
const& ftData, IceUtil::Time
timestamp);
255 const NameValueMap& nv,
256 const std::string name)
const;
257 void rtUpdateSensors(
bool wait);
258 void rtSendCommands();
260 bool skipReport()
const;
263 getMappedFTName(
const std::string& name)
const
265 return ftMappings.count(name) ? ftMappings.at(name).sensorName : name;
269 getMappedFTReportingFrame(
const std::string& name,
const std::string& unmappedFrame)
const
271 return ftMappings.count(name) ? ftMappings.at(name).reportFrame : unmappedFrame;
275 getMappedFTReportingTransformation(
const std::string& name)
const
277 return ftMappings.count(name) ? ftMappings.at(name).reportTransformation
278 : Eigen::Matrix3f::Identity();
281 void rtPollRobotState();
282 std::atomic_bool isPolling{
false};
286 Eigen::Vector3f lin{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
287 Eigen::Vector3f ang{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
292 Eigen::Vector3f force{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
293 Eigen::Vector3f torque{std::nanf(
""), std::nanf(
""), std::nanf(
"")};
299 std::condition_variable cvGotSensorData;
300 std::atomic<bool> gotSensorData{
false};
301 IceUtil::Time sensorValuesTimestamp;
303 KeyValueVector<std::string, JointSimulationDevicePtr> jointDevs;
304 TripleBufferWithGuardAndTime<std::vector<float>> torquesTB;
305 TripleBufferWithGuardAndTime<std::vector<float>> anglesTB;
306 TripleBufferWithGuardAndTime<std::vector<float>> velocitiesTB;
311 PlatformSimulationDevicePtr platformDev;
313 TripleBufferWithGuardAndTime<Eigen::Matrix4f> robPoseTB;
314 TripleBufferWithGuardAndTime<RobVel> robVelTB;
316 KeyValueVector<std::string, ForceTorqueSimulationSensorDevicePtr> forceTorqueDevs;
317 TripleBufferWithGuardAndTime<std::vector<FT>> forceTorqueTB;
318 std::vector<AtomicWrapper<std::uintmax_t>> forceTorqueTimes;
322 std::string sensorName;
323 std::string originalReportFrame;
324 std::string reportFrame;
325 Eigen::Matrix3f reportTransformation;
328 std::map<std::string, FTMappingData> ftMappings;
336 std::atomic_bool synchronizedSimulation;
337 IceUtil::Time controlIterationMs;
338 std::string simulatorRobotListenerInterfaceTopic;
339 std::string simulatorForceTorqueListenerInterfaceTopic;
341 std::atomic<std::uintmax_t> iterationCount{0};
348 return controlIterationMs;