Robotic Frameworks Rotating Robots in Specific Directions in Python
Robotic Frameworks Rotating Robots in Specific Directions in Python
Frameworks:
Rotating Robots in
Specific Directions
in Python
BY MAMIDI VARSHA
Introduction to Robotic
Frameworks
1 Fundamental Concepts 2 Versatile Platforms
Understand the core Explore the diverse range
principles and components of robotic frameworks
of modern robotic available, each with its
frameworks, including own strengths and
kinematics, dynamics, and applications.
control systems.
3 Python Integration
Leverage the power of Python's extensive libraries and tools to
seamlessly integrate robotic frameworks into your projects.
Fundamentals of Robot Motion
1 Degrees of Freedom
Understand the concept of degrees of freedom and
how they define a robot's range of motion.
2 Coordinate Systems
Explore the different coordinate systems used to
represent a robot's position and orientation.
Understand the mathematical and Learn how to use rotation matrices Explore real-world scenarios where
geometric concepts behind rotating to represent and apply rotational 2D rotation is a critical component of
a robot in a 2D coordinate plane. transformations in 2D space. robotic systems.
Rotation in 3D Coordinate Space
3 Continuous Innovation
Stay ahead of the curve and explore the latest advancements
in robotic frameworks and rotation technology.
class Robot:
def init(self, name):
self.name = name
self.position = (0, 0)
if self.orientation == 'N':
if self.orientation == 'N':
self.orientation = 'W'
self.orientation = 'E'
self.orientation = 'N'
self.orientation = 'S'
self.orientation = 'NW'
self.orientation = 'SW'
self.orientation = 'NE'
self.orientation = 'SE'
elif direction == 'R':
if self.orientation == 'N':
self.orientation = 'E'
self.orientation = 'W'
self.orientation = 'S'
self.orientation = 'N'
self.orientation = 'SE'
self.orientation = 'NE'
self.orientation = 'SW'
self.orientation = 'NW'
def report(self):
print(f"Robot {self.name}: Position ({self.position[0]}, {self.position[1]}), Orientation: {self.orientation}")
class TestRobot:
self.robot = robot
def test_move_forward(self):
initial_position = self.robot.position
self.robot.move(1)
def test_rotate_left(self):
initial_orientation = self.robot.orientation
self.robot.rotate('L')
def test_rotate_right(self):
initial_orientation = self.robot.orientation
self.robot.rotate('R')
def test_move_backward(self):
initial_position = self.robot.position
self.robot.move(-1)
self.robot.orientation = 'NE'
self.robot.move(-1)
def test_move_diagonally_backward(self):
initial_position = self.robot.position
self.robot.orientation = 'SW'
self.robot.move(-1)
def run_all_tests(self):
self.test_move_forward()
self.test_rotate_left()
self.test_rotate_right()
self.test_move_backward()
self.test_move_diagonally_forword()
self.test_move_diagonally_backward()
my_robot = Robot("Varsha")
tester = TestRobot(my_robot)
test.run_all_tests()
# Example usage:
my_robot.move(0)
my_robot.rotate('L')
my_robot.move(1)
my_robot.report()
my_robot.orientation = 'NE'
my_robot.move(1)
my_robot.report()
my_robot.orientation = 'SW'
my_robot.move(-1)
my_robot.report()
OUTPUT:
All tests passed! Robot Varsha: Position (1, -1),
Orientation: SE Robot Varsha: Position (2, 0),
Orientation: NE Robot Varsha: Position (3, 1),
Orientation: SW
THANKYOU