@@ -59,8 +59,9 @@ struct DataToLog {
59
59
60
60
void workThreadLoader (SotLoader *aSotLoader) {
61
61
ros::Rate rate (1000 ); // 1 kHz
62
+ double periodd (1e-3 );
63
+
62
64
if (ros::param::has (" /sot_controller/dt" )) {
63
- double periodd;
64
65
ros::param::get (" /sot_controller/dt" , periodd);
65
66
rate = ros::Rate (1 / periodd);
66
67
}
@@ -80,7 +81,7 @@ void workThreadLoader(SotLoader *aSotLoader) {
80
81
81
82
if (!paused) {
82
83
time = ros::Time::now ();
83
- aSotLoader->oneIteration ();
84
+ aSotLoader->oneIteration (periodd );
84
85
85
86
ros::Duration d = ros::Time::now () - time;
86
87
dataToLog.record ((time - timeOrigin).toSec (), d.toSec ());
@@ -200,15 +201,15 @@ void SotLoader::readControl(map<string, dgs::ControlValues> &controlValues) {
200
201
void SotLoader::setup () {
201
202
fillSensors (sensorsIn_);
202
203
sotController_->setupSetSensors (sensorsIn_);
203
- sotController_->getControl (controlValues_);
204
+ sotController_->getControl (controlValues_, 0 );
204
205
readControl (controlValues_);
205
206
}
206
207
207
- void SotLoader::oneIteration () {
208
+ void SotLoader::oneIteration (const double & period ) {
208
209
fillSensors (sensorsIn_);
209
210
try {
210
211
sotController_->nominalSetSensors (sensorsIn_);
211
- sotController_->getControl (controlValues_);
212
+ sotController_->getControl (controlValues_, period );
212
213
} catch (std::exception &) {
213
214
throw ;
214
215
}
0 commit comments