Hi, i have not been able to go past the main in task3.py, which states that the robot should stop after crossing the walls.I have spend a lot of time on this, and now i guess its time to ask the communities opinion.
The problem i am facing are two:
1. The robot does not move in a straight line and deviates slightly from the path as it moves forward. Is this error programmed into to mimic real-life scenarios or is it a fault in my code.
I have attached pics of the ideal path in red vs the actual path taken in blue.
At the start:
Code used task2.py:
#! usr/bin/env python
import rospy
from robot_control_class import RobotControl
RC=RobotControl()
while(RC.get_laser(360)>=1):
print(RC.get_laser(360))
RC.move_straight_time("forward",0.125,2)
#the below line makes it to turn 90 degree approx, but was commented out when running the program since the problem at hand is the variation while moving in straight line.
#RC.turn("anticlockwise",0.25,5.95)
**After **
The line RC.move_straight_time("forward",0.125,2)
should have made the robot move straight, but it deviates towards the end. Since these varantions are not the same everytime, RC.turn("anticlockwise",0.25,5.95)
also gives different outputs making it difficult to position it straight into the wall opening.
Even though the robot is running at a low speed of 0.125, its still deviating from the path slightly towards the end. Can i know why this happens? Because of this, when i turn 90 degree to face the opening, it does not aligh perfectly with the wall opening, causing it to crash into the side of the opening.
2.under task3, the robot has to move past the opening and stop after crossing the wall. in my case as soon as it reaches the wall, it stops moving, can i know why?.
class ExamControl:
def __init__(self):
self.RC=RobotControl()
def get_laser_readings(self):
return self.RC.get_laser(719),self.RC.get_laser(0)
def main(self):
while(((self.RC.get_laser(0)!=inf) and (self.RC.get_laser(719)!=inf))):
print("Right=",self.RC.get_laser(0))
print("Left",self.RC.get_laser(719))
print("Moving Forward")
self.RC.move_straight_time("forward",0.3,1)
print("Moved Forward")
rospy.sleep(0.2)