@@ -148,9 +148,6 @@ void Direct::Initialize(const mjModel* model) {
148148 act.Initialize (na, configuration_length_);
149149 times.Initialize (1 , configuration_length_);
150150
151- // ctrl
152- ctrl.Initialize (model->nu , configuration_length_);
153-
154151 // prior
155152 configuration_previous.Initialize (nq, configuration_length_);
156153
@@ -348,7 +345,6 @@ void Direct::Reset(const mjData* data) {
348345 acceleration.Reset ();
349346 act.Reset ();
350347 times.Reset ();
351- ctrl.Reset ();
352348
353349 // prior
354350 configuration_previous.Reset ();
@@ -637,8 +633,6 @@ void Direct::SetConfigurationLength(int length) {
637633 act.SetLength (configuration_length_);
638634 times.SetLength (configuration_length_);
639635
640- ctrl.SetLength (configuration_length_);
641-
642636 configuration_previous.SetLength (configuration_length_);
643637
644638 sensor_measurement.SetLength (configuration_length_);
@@ -1489,8 +1483,7 @@ void Direct::InverseDynamicsPrediction() {
14891483 auto start = std::chrono::steady_clock::now ();
14901484
14911485 // dimension
1492- int nq = model->nq , nv = model->nv , na = model->na , nu = model->nu ,
1493- ns = nsensordata_;
1486+ int nq = model->nq , nv = model->nv , na = model->na , ns = nsensordata_;
14941487
14951488 // set parameters
14961489 if (nparam_ > 0 ) {
@@ -1502,7 +1495,7 @@ void Direct::InverseDynamicsPrediction() {
15021495 int count_before = pool_.GetCount ();
15031496
15041497 // first time step
1505- pool_.Schedule ([&batch = *this , nq, nv, nu ]() {
1498+ pool_.Schedule ([&batch = *this , nq, nv]() {
15061499 // time index
15071500 int t = 0 ;
15081501
@@ -1518,7 +1511,6 @@ void Direct::InverseDynamicsPrediction() {
15181511 mju_copy (d->qpos , q0, nq);
15191512 mju_zero (d->qvel , nv);
15201513 mju_zero (d->qacc , nv);
1521- mju_zero (d->ctrl , nu);
15221514 d->time = batch.times .Get (t)[0 ];
15231515
15241516 // position sensors
@@ -1551,12 +1543,11 @@ void Direct::InverseDynamicsPrediction() {
15511543 // loop over predictions
15521544 for (int t = 1 ; t < configuration_length_ - 1 ; t++) {
15531545 // schedule
1554- pool_.Schedule ([&batch = *this , nq, nv, na, ns, nu, t]() {
1546+ pool_.Schedule ([&batch = *this , nq, nv, na, ns, t]() {
15551547 // terms
15561548 double * qt = batch.configuration .Get (t);
15571549 double * vt = batch.velocity .Get (t);
15581550 double * at = batch.acceleration .Get (t);
1559- double * ct = batch.ctrl .Get (t);
15601551
15611552 // data
15621553 mjData* d = batch.data_ [t].get ();
@@ -1565,7 +1556,6 @@ void Direct::InverseDynamicsPrediction() {
15651556 mju_copy (d->qpos , qt, nq);
15661557 mju_copy (d->qvel , vt, nv);
15671558 mju_copy (d->qacc , at, nv);
1568- mju_copy (d->ctrl , ct, nu);
15691559
15701560 // inverse dynamics
15711561 mj_inverse (batch.model , d);
@@ -1585,7 +1575,7 @@ void Direct::InverseDynamicsPrediction() {
15851575 }
15861576
15871577 // last time step
1588- pool_.Schedule ([&batch = *this , nq, nv, nu ]() {
1578+ pool_.Schedule ([&batch = *this , nq, nv]() {
15891579 // time index
15901580 int t = batch.ConfigurationLength () - 1 ;
15911581
@@ -1602,7 +1592,6 @@ void Direct::InverseDynamicsPrediction() {
16021592 mju_copy (d->qpos , qT, nq);
16031593 mju_copy (d->qvel , vT, nv);
16041594 mju_zero (d->qacc , nv);
1605- mju_zero (d->ctrl , nu);
16061595 d->time = batch.times .Get (t)[0 ];
16071596
16081597 // position sensors
@@ -1653,7 +1642,7 @@ void Direct::InverseDynamicsDerivatives() {
16531642 auto start = std::chrono::steady_clock::now ();
16541643
16551644 // dimension
1656- int nq = model->nq , nv = model->nv , nu = model-> nu ;
1645+ int nq = model->nq , nv = model->nv ;
16571646
16581647 // set parameters
16591648 if (nparam_ > 0 ) {
@@ -1665,7 +1654,7 @@ void Direct::InverseDynamicsDerivatives() {
16651654 int count_before = pool_.GetCount ();
16661655
16671656 // first time step
1668- pool_.Schedule ([&batch = *this , nq, nv, nu ]() {
1657+ pool_.Schedule ([&batch = *this , nq, nv]() {
16691658 // time index
16701659 int t = 0 ;
16711660
@@ -1680,7 +1669,6 @@ void Direct::InverseDynamicsDerivatives() {
16801669 mju_copy (d->qpos , q0, nq);
16811670 mju_zero (d->qvel , nv);
16821671 mju_zero (d->qacc , nv);
1683- mju_zero (d->ctrl , nu);
16841672 d->time = batch.times .Get (t)[0 ];
16851673
16861674 // finite-difference derivatives
@@ -1725,12 +1713,11 @@ void Direct::InverseDynamicsDerivatives() {
17251713 // loop over predictions
17261714 for (int t = 1 ; t < configuration_length_ - 1 ; t++) {
17271715 // schedule
1728- pool_.Schedule ([&batch = *this , nq, nv, nu, t]() {
1716+ pool_.Schedule ([&batch = *this , nq, nv, t]() {
17291717 // unpack
17301718 double * q = batch.configuration .Get (t);
17311719 double * v = batch.velocity .Get (t);
17321720 double * a = batch.acceleration .Get (t);
1733- double * c = batch.ctrl .Get (t);
17341721
17351722 double * dsdq = batch.block_sensor_configuration_ .Get (t);
17361723 double * dsdv = batch.block_sensor_velocity_ .Get (t);
@@ -1743,11 +1730,10 @@ void Direct::InverseDynamicsDerivatives() {
17431730 double * dadf = batch.block_force_acceleration_ .Get (t);
17441731 mjData* data = batch.data_ [t].get (); // TODO(taylor): WorkerID
17451732
1746- // set ( state, acceleration) + ctrl
1733+ // set state, acceleration
17471734 mju_copy (data->qpos , q, nq);
17481735 mju_copy (data->qvel , v, nv);
17491736 mju_copy (data->qacc , a, nv);
1750- mju_copy (data->ctrl , c, nu);
17511737
17521738 // finite-difference derivatives
17531739 mjd_inverseFD (batch.model , data, batch.finite_difference .tolerance ,
@@ -1767,7 +1753,7 @@ void Direct::InverseDynamicsDerivatives() {
17671753 }
17681754
17691755 // last time step
1770- pool_.Schedule ([&batch = *this , nq, nv, nu ]() {
1756+ pool_.Schedule ([&batch = *this , nq, nv]() {
17711757 // time index
17721758 int t = batch.ConfigurationLength () - 1 ;
17731759
@@ -1784,7 +1770,6 @@ void Direct::InverseDynamicsDerivatives() {
17841770 mju_copy (d->qpos , qT, nq);
17851771 mju_copy (d->qvel , vT, nv);
17861772 mju_zero (d->qacc , nv);
1787- mju_zero (d->ctrl , nu);
17881773 d->time = batch.times .Get (t)[0 ];
17891774
17901775 // finite-difference derivatives
@@ -2061,7 +2046,7 @@ double Direct::Cost(double* gradient, double* hessian) {
20612046 // set dense rows in band Hessian
20622047 if (hessian) {
20632048 mju_copy (hessian + nvel_ * nband_, dense_parameter_.data (),
2064- nparam_ * ntotal_);
2049+ nparam_ * ntotal_);
20652050 }
20662051 }
20672052
0 commit comments