@@ -1468,29 +1468,40 @@ bool WheelSlipCommand::Execute()
1468
1468
return false ;
1469
1469
}
1470
1470
Model model{modelEntity};
1471
- Entity linkEntity = model.LinkByName (
1472
- *this ->iface ->ecm , wheelSlipMsg->link_name ());
1473
- if (kNullEntity == linkEntity)
1474
- {
1475
- ignerr << " Failed to find link with name [" << wheelSlipMsg->link_name ()
1476
- << " ] for model [" << wheelSlipMsg->model_name () << " ]."
1477
- << std::endl;
1478
- return false ;
1479
- }
1471
+ auto linkName = wheelSlipMsg->link_name ();
1480
1472
1481
- auto wheelSlipCmdComp =
1473
+ auto doForEachLink = [this , wheelSlipMsg](Entity linkEntity) {
1474
+ auto wheelSlipCmdComp =
1482
1475
this ->iface ->ecm ->Component <components::WheelSlipCmd>(linkEntity);
1483
- if (!wheelSlipCmdComp)
1484
- {
1485
- this ->iface ->ecm ->CreateComponent (
1486
- linkEntity, components::WheelSlipCmd (*wheelSlipMsg));
1487
- }
1488
- else
1489
- {
1490
- auto state = wheelSlipCmdComp->SetData (*wheelSlipMsg, this ->wheelSlipEql ) ?
1491
- ComponentState::OneTimeChange : ComponentState::NoChange;
1492
- this ->iface ->ecm ->SetChanged (
1493
- linkEntity, components::WheelSlipCmd::typeId, state);
1476
+ if (!wheelSlipCmdComp)
1477
+ {
1478
+ this ->iface ->ecm ->CreateComponent (
1479
+ linkEntity, components::WheelSlipCmd (*wheelSlipMsg));
1480
+ }
1481
+ else
1482
+ {
1483
+ auto state = wheelSlipCmdComp->SetData (*wheelSlipMsg, this ->wheelSlipEql ) ?
1484
+ ComponentState::OneTimeChange : ComponentState::NoChange;
1485
+ this ->iface ->ecm ->SetChanged (
1486
+ linkEntity, components::WheelSlipCmd::typeId, state);
1487
+ }
1488
+ };
1489
+
1490
+ if (linkName != " *" ) {
1491
+ Entity linkEntity = model.LinkByName (
1492
+ *this ->iface ->ecm , wheelSlipMsg->link_name ());
1493
+ if (kNullEntity == linkEntity)
1494
+ {
1495
+ ignerr << " Failed to find link with name [" << wheelSlipMsg->link_name ()
1496
+ << " ] for model [" << wheelSlipMsg->model_name () << " ]."
1497
+ << std::endl;
1498
+ return false ;
1499
+ }
1500
+ doForEachLink (linkEntity);
1501
+ } else {
1502
+ for (const auto & linkEntity : model.Links (*this ->iface ->ecm )) {
1503
+ doForEachLink (linkEntity);
1504
+ }
1494
1505
}
1495
1506
return true ;
1496
1507
}
0 commit comments