In a robotic arm controller, it is crucial to manage error states to ensure patient safety. You are tasked with implementing a function that takes a list of error states and returns a list of safe commands that can be executed. Each error state is represented by an integer where positive values indicate safe commands and negative values indicate errors.
error_states where:
error_states[i] > 0 indicates a safe command.error_states[i] <= 0 indicates an error state.Example 1:
Input: error_states = [1, -1, 2, -3, 3]
Output: [1, 2, 3]
Explanation: The safe commands are 1, 2, and 3.
Example 2:
Input: error_states = [-1, -2, -3]
Output: []
Explanation: There are no safe commands in this case.
1 <= error_states.length <= 1000-1000 <= error_states[i] <= 1000