Skip to content

Commit 17a992f

Browse files
[SotLoader] Update to recent modifications in sot-core.
1 parent 3205595 commit 17a992f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

include/dynamic_graph_bridge/sot_loader.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class SotLoader : public SotLoaderBasic {
8888

8989
// \brief Compute one iteration of control.
9090
// Basically calls fillSensors, the SoT and the readControl.
91-
void oneIteration();
91+
void oneIteration(const double& period);
9292

9393
// \brief Fill the sensors value for the SoT.
9494
void fillSensors(std::map<std::string, dgs::SensorValues> &sensorsIn);

src/sot_loader.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ struct DataToLog {
5959

6060
void workThreadLoader(SotLoader *aSotLoader) {
6161
ros::Rate rate(1000); // 1 kHz
62+
double periodd (1e-3);
63+
6264
if (ros::param::has("/sot_controller/dt")) {
63-
double periodd;
6465
ros::param::get("/sot_controller/dt", periodd);
6566
rate = ros::Rate(1 / periodd);
6667
}
@@ -80,7 +81,7 @@ void workThreadLoader(SotLoader *aSotLoader) {
8081

8182
if (!paused) {
8283
time = ros::Time::now();
83-
aSotLoader->oneIteration();
84+
aSotLoader->oneIteration(periodd);
8485

8586
ros::Duration d = ros::Time::now() - time;
8687
dataToLog.record((time - timeOrigin).toSec(), d.toSec());
@@ -200,15 +201,15 @@ void SotLoader::readControl(map<string, dgs::ControlValues> &controlValues) {
200201
void SotLoader::setup() {
201202
fillSensors(sensorsIn_);
202203
sotController_->setupSetSensors(sensorsIn_);
203-
sotController_->getControl(controlValues_);
204+
sotController_->getControl(controlValues_, 0);
204205
readControl(controlValues_);
205206
}
206207

207-
void SotLoader::oneIteration() {
208+
void SotLoader::oneIteration(const double& period) {
208209
fillSensors(sensorsIn_);
209210
try {
210211
sotController_->nominalSetSensors(sensorsIn_);
211-
sotController_->getControl(controlValues_);
212+
sotController_->getControl(controlValues_, period);
212213
} catch (std::exception &) {
213214
throw;
214215
}

0 commit comments

Comments
 (0)