NasserCzar
NasserCzar

Reputation: 3

robotcontrol turn right degrees and move forward , using ROS

I checked the First and Second works great the Third i got error with

    robotcontrol.turn_right(90)

AttributeError: RobotControl instance has no attribute 'turn_right'

My Code :

from robot_control_class import RobotControl

robotcontrol = RobotControl()

# First, it starts moving the robot forwards while it captures the laser readings in front of the robot.
a = robotcontrol.get_laser(360)

# Then, it checks if the distance to the wall is less than 1 meter. If it is, it stops the robot.
while a > 1:
    robotcontrol.move_straight()
    a = robotcontrol.get_laser(360)
    print ("Current distance to wall: %f" % a)
    robotcontrol.stop_robot()

# third, it turns the robot 90 degrees to the right and starts moving it forwards again.
    robotcontrol.turn_right(90)
    robotcontrol.move_straight()   

Upvotes: 0

Views: 133

Answers (1)

Fruchtzwerg
Fruchtzwerg

Reputation: 11399

I assume you are using arnaldojr/Python-3-for-Robotics . Looking at the source code, you can see there is no method called turn_right. You need to use turn(self, clockwise, speed, time) instead.

So something like

robotcontrol.turn("clockwise", 90, 1, 1)

should solve your problem.

Upvotes: 1

Related Questions