Skip to content

Commit

Permalink
fix: avoid function renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
domire8 committed Apr 17, 2024
1 parent 3f1d413 commit f912b9d
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ inline void safe_spatial_state_conversion(
* @param conversion_callback A callback function taking parameters of type StateT and NewStateT, where the
* referenced StateT instance can be modified as needed from the NewStateT value
*/
// FIXME(#77): rename this upon modulo 5.0
template<typename StateT, typename NewStateT>
inline void safe_state_with_names_conversion(
inline void safe_joint_state_conversion(
std::shared_ptr<state_representation::State>& state, std::shared_ptr<state_representation::State>& new_state,
std::function<void(StateT&, const NewStateT&)> conversion_callback = {}
) {
Expand Down Expand Up @@ -400,22 +401,22 @@ inline void read_message(std::shared_ptr<state_representation::State>& state, co
case StateType::JOINT_STATE: {
auto derived_state = safe_dynamic_pointer_cast<JointState>(state);
if (new_state->get_type() == StateType::JOINT_POSITIONS) {
safe_state_with_names_conversion<JointState, JointPositions>(
safe_joint_state_conversion<JointState, JointPositions>(
state, new_state, [](JointState& a, const JointPositions& b) {
a.set_positions(b.get_positions());
});
} else if (new_state->get_type() == StateType::JOINT_VELOCITIES) {
safe_state_with_names_conversion<JointState, JointVelocities>(
safe_joint_state_conversion<JointState, JointVelocities>(
state, new_state, [](JointState& a, const JointVelocities& b) {
a.set_velocities(b.get_velocities());
});
} else if (new_state->get_type() == StateType::JOINT_ACCELERATIONS) {
safe_state_with_names_conversion<JointState, JointAccelerations>(
safe_joint_state_conversion<JointState, JointAccelerations>(
state, new_state, [](JointState& a, const JointAccelerations& b) {
a.set_accelerations(b.get_accelerations());
});
} else if (new_state->get_type() == StateType::JOINT_TORQUES) {
safe_state_with_names_conversion<JointState, JointTorques>(
safe_joint_state_conversion<JointState, JointTorques>(
state, new_state, [](JointState& a, const JointTorques& b) {
a.set_torques(b.get_torques());
});
Expand All @@ -426,7 +427,7 @@ inline void read_message(std::shared_ptr<state_representation::State>& state, co
}
case StateType::JOINT_POSITIONS: {
if (new_state->get_type() == StateType::JOINT_STATE) {
safe_state_with_names_conversion<JointPositions, JointState>(
safe_joint_state_conversion<JointPositions, JointState>(
state, new_state, [](JointPositions& a, const JointState& b) {
a.set_positions(b.get_positions());
});
Expand All @@ -437,7 +438,7 @@ inline void read_message(std::shared_ptr<state_representation::State>& state, co
}
case StateType::JOINT_VELOCITIES: {
if (new_state->get_type() == StateType::JOINT_STATE) {
safe_state_with_names_conversion<JointVelocities, JointState>(
safe_joint_state_conversion<JointVelocities, JointState>(
state, new_state, [](JointVelocities& a, const JointState& b) {
a.set_velocities(b.get_velocities());
});
Expand All @@ -448,7 +449,7 @@ inline void read_message(std::shared_ptr<state_representation::State>& state, co
}
case StateType::JOINT_ACCELERATIONS: {
if (new_state->get_type() == StateType::JOINT_STATE) {
safe_state_with_names_conversion<JointAccelerations, JointState>(
safe_joint_state_conversion<JointAccelerations, JointState>(
state, new_state, [](JointAccelerations& a, const JointState& b) {
a.set_accelerations(b.get_accelerations());
});
Expand All @@ -459,7 +460,7 @@ inline void read_message(std::shared_ptr<state_representation::State>& state, co
}
case StateType::JOINT_TORQUES: {
if (new_state->get_type() == StateType::JOINT_STATE) {
safe_state_with_names_conversion<JointTorques, JointState>(
safe_joint_state_conversion<JointTorques, JointState>(
state, new_state, [](JointTorques& a, const JointState& b) {
a.set_torques(b.get_torques());
});
Expand Down

0 comments on commit f912b9d

Please sign in to comment.