@@ -964,7 +964,7 @@ void EnvironmentXYZTheta::getTrajectory(const vector<int>& stateIDPath,
964
964
V3DD::CLEAR_DRAWING (" ugv_nav4d_trajectory" );
965
965
#endif
966
966
967
- int indexOfMotionToUpdate{stateIDPath.size ()-2 };
967
+ size_t indexOfMotionToUpdate{stateIDPath.size ()-2 };
968
968
const Motion& finalMotion = getMotion (stateIDPath[stateIDPath.size ()-2 ], stateIDPath[stateIDPath.size ()-1 ]);
969
969
if (finalMotion.type == Motion::Type::MOV_POINTTURN && stateIDPath.size () > 2 ){ // assuming that there are no consecutive point turns motion at the end of a planned trajectory
970
970
indexOfMotionToUpdate = stateIDPath.size ()-3 ;
@@ -1089,26 +1089,10 @@ void EnvironmentXYZTheta::getTrajectory(const vector<int>& stateIDPath,
1089
1089
}
1090
1090
else
1091
1091
{
1092
- if (curMotion.type == Motion::Type::MOV_BACKWARD)
1093
- {
1094
- curPart.speed = -mobilityConfig.translationSpeed ;
1095
- }
1096
- else
1097
- {
1098
- curPart.speed = mobilityConfig.translationSpeed ;
1099
- }
1100
1092
SubTrajectory curPartSub (curPart);
1101
- switch (curMotion.type ) {
1102
- case Motion::Type::MOV_FORWARD:
1103
- curPartSub.driveMode = DriveMode::ModeAckermann;
1104
- break ;
1105
- case Motion::Type::MOV_BACKWARD:
1106
- curPartSub.driveMode = DriveMode::ModeAckermann;
1107
- break ;
1108
- case Motion::Type::MOV_LATERAL:
1109
- curPartSub.driveMode = DriveMode::ModeSideways;
1110
- break ;
1111
- }
1093
+ curPartSub.speed = (curMotion.type == Motion::Type::MOV_BACKWARD) ? -mobilityConfig.translationSpeed : mobilityConfig.translationSpeed ;
1094
+ curPartSub.driveMode = (curMotion.type == Motion::Type::MOV_LATERAL) ? DriveMode::ModeSideways : DriveMode::ModeAckermann;
1095
+
1112
1096
result.push_back (curPartSub);
1113
1097
1114
1098
if (goal_position_updated){
0 commit comments