We have train the autonomous vehicle with digits to recognise Arrows. Our tk1 default state will keep left, so when it sees the arrow it will keep right. Then when in sees the arrow again it will keep left. However the issue is when it recognise the arrows with the left and right direction. It only keeps left.
This is our codes.
if(srv.response.classification==“Arrow”){
if (classify_straight_count < 4)
{
motor_msg.data = 7;//KeepLeft
motor_pub.publish(motor_msg);
classify_straight_count = 4;
}
else if (classify_straight_count < 8 || classify_straight_count > 4 )
{
motor_msg.data = 6; //KeepRight
motor_pub.publish(motor_msg);
classify_straight_count = 8;
}
Thefore this code we are trying to do is when the car reach the junction and see the two way arrow,it will keep left as the default state is keep left. Once its see the same error again, it will go the alternate direction. This is to make it move in the figure of 8.