no safety guard in mpc_controller for zero length trajectory
Description
mpc_controller crashes if it receives a trajectory with no trajectory points or an empty msg. It needs to be more robust.
How to Reproduce
- run mpc_controller node
ros2 topic pub trajectory autoware_auto_msgs/msg/Trajectory {}
Current Behavior
Crashing with the following error
[mpc_controller_node_exe-1] terminate called after throwing an instance of 'std::runtime_error'
[mpc_controller_node_exe-1] what(): Cannot get reference state index: no or zero length trajectory
[ERROR] [mpc_controller_node_exe-1]: process has died
Expected behavior
- Should ignore or stop/slow down the vehicle, based on design decision.
- Should not crash, might create diagnostics error msgs
Edited by Joshua Whitley