@@ -344,42 +344,74 @@ void DifferentialTransmission::configure(
344344 get_handles_info ()));
345345 }
346346
347- if (joint_position_.size () != actuator_position_.size ())
347+ if (
348+ !joint_position_.empty () && !actuator_position_.empty () &&
349+ joint_position_.size () != actuator_position_.size ())
348350 {
349351 throw Exception (
350352 fmt::format (
351353 FMT_COMPILE (" Pair-wise mismatch on position interfaces. \n {}" ), get_handles_info ()));
352354 }
353- if (joint_velocity_.size () != actuator_velocity_.size ())
355+ if (
356+ !joint_velocity_.empty () && !actuator_velocity_.empty () &&
357+ joint_velocity_.size () != actuator_velocity_.size ())
354358 {
355359 throw Exception (
356360 fmt::format (
357361 FMT_COMPILE (" Pair-wise mismatch on velocity interfaces. \n {}" ), get_handles_info ()));
358362 }
359- if (joint_effort_.size () != actuator_effort_.size ())
363+ if (
364+ !joint_effort_.empty () && !actuator_effort_.empty () &&
365+ joint_effort_.size () != actuator_effort_.size ())
360366 {
361367 throw Exception (
362368 fmt::format (
363369 FMT_COMPILE (" Pair-wise mismatch on effort interfaces. \n {}" ), get_handles_info ()));
364370 }
365- if (joint_torque_.size () != actuator_torque_.size ())
371+ if (
372+ !joint_torque_.empty () && !actuator_torque_.empty () &&
373+ joint_torque_.size () != actuator_torque_.size ())
366374 {
367375 throw Exception (
368376 fmt::format (
369377 FMT_COMPILE (" Pair-wise mismatch on torque interfaces. \n {}" ), get_handles_info ()));
370378 }
371- if (joint_force_.size () != actuator_force_.size ())
379+ if (
380+ !joint_force_.empty () && !actuator_force_.empty () &&
381+ joint_force_.size () != actuator_force_.size ())
372382 {
373383 throw Exception (
374384 fmt::format (FMT_COMPILE (" Pair-wise mismatch on force interfaces. \n {}" ), get_handles_info ()));
375385 }
376- if (joint_absolute_position_.size () != actuator_absolute_position_.size ())
386+ if (
387+ !joint_absolute_position_.empty () && !actuator_absolute_position_.empty () &&
388+ joint_absolute_position_.size () != actuator_absolute_position_.size ())
377389 {
378390 throw Exception (
379391 fmt::format (
380392 FMT_COMPILE (" Pair-wise mismatch on absolute position interfaces. \n {}" ),
381393 get_handles_info ()));
382394 }
395+
396+ // Check at least one pair-wise interface is available
397+ if (!((!joint_position_.empty () && !actuator_position_.empty () &&
398+ joint_position_.size () == actuator_position_.size ()) ||
399+ (!joint_velocity_.empty () && !actuator_velocity_.empty () &&
400+ joint_velocity_.size () == actuator_velocity_.size ()) ||
401+ (!joint_effort_.empty () && !actuator_effort_.empty () &&
402+ joint_effort_.size () == actuator_effort_.size ()) ||
403+ (!joint_torque_.empty () && !actuator_torque_.empty () &&
404+ joint_torque_.size () == actuator_torque_.size ()) ||
405+ (!joint_force_.empty () && !actuator_force_.empty () &&
406+ joint_force_.size () == actuator_force_.size ()) ||
407+ (!joint_absolute_position_.empty () && !actuator_absolute_position_.empty () &&
408+ joint_absolute_position_.size () == actuator_absolute_position_.size ())))
409+ {
410+ throw Exception (
411+ fmt::format (
412+ FMT_COMPILE (" No pair-wise interface available between joints and actuators. \n {}" ),
413+ get_handles_info ()));
414+ }
383415}
384416
385417inline void DifferentialTransmission::actuator_to_joint ()
0 commit comments