Team Mission - Moving Robot
Project Name: Moving Robot
- This mission is a team project
- Write code to move the robot using ROS Topic.
- Control your robot according to your purpose.
Let’s draw shapes with a robot - 1
Let’s control the robot by applying the robot_command topic.
Control the robot to draw the letter ‘ㄱ’ with one code execution.
Hint!
move(1)
turn(-90)
move(1)
stop()
Let’s draw a circle with a robot
Let’s control the robot by applying the robot_command topic.
With one code execution, the robot is controlled to rotate by 1 degree and draw a circle.
Hint!
for angle in range(360):
turnTo(angle)
time.sleep(1)
Let’s draw shapes with a robot - 2
Let’s control the robot by applying the robot_command topic.
Control the robot to draw 8 characters with a single code execution.
Hint!
for _ in range(3):
move_forward()
time.sleep(2)
stop()
turn_right()
time.sleep(1)
for _ in range(4):
move_forward()
time.sleep(2)
stop()
turn_left()
time.sleep(1)
Let’s move the robot by receiving keyboard input.
Let’s control the robot by applying the robot_command topic.
It receives text input from the user and controls the robot to move. (w: forward, s: backward, a: turn left, d: turn right)
Hint!
while True:
user_input = input("Enter a command (w: Forward, a: Left Turn, d: Right Turn, s: Reverse, q: Quit): ")
if user_input == 'w’:
move_forward()
elif user_input == 's’:
stop()
elif user_input == 'a’:
turn_left()
elif user_input == 'd’:
turn_right()