Regarding task2.sh, I don’t know why the code runs correctly (calling the correct function, but the evaluation keeps putting it wrong. Not sure if I understood what was asked.
#!/bin/bash
read opcion
if [ $opcion == "small_square" ]; then
rosrun linux_exam small_square.py;
elif [ $opcion == "medium_square" ]; then
rosrun linux_exam medium_square.py;
elif [ $opcion == "big_square" ]; then
rosrun linux_exam big_square.py;
else
echo "choose other option"
exit 1
fi
For the case of task1.py, also i don’t know what’s wrong with it since the code does return the highest and the lowest indexes, and the code does not show errors
from robot_control_class import RobotControl
def get_highest_lowest():
control = RobotControl()
tupleallvalues = control.get_laser_full()
allvalues = list(tupleallvalues)
for i in range(len(allvalues)-1, -1, -1):
if allvalues[i] == float('inf'):
del allvalues[i]
max = allvalues[0]
for i in range(len(allvalues)-1):
if max < allvalues[i]:
max = allvalues[i]
poshigh = allvalues.index(max)
min = allvalues[0]
for i in range(len(allvalues)-1):
if min > allvalues[i]:
min = allvalues[i]
poslow = allvalues.index(min)
return poshigh, poslow