Complete the code to import the ROS Python client library.
import [1]
The rospy library is used to write ROS nodes in Python, including teleoperation scripts.
Complete the code to create a publisher for velocity commands.
pub = rospy.Publisher('[1]', Twist, queue_size=10)
The /cmd_vel topic is the standard topic for sending velocity commands to a robot in ROS.
Fix the error in the code to read keyboard input without blocking.
key = getKey([1])The getKey function uses a timeout in seconds to read keyboard input without blocking. Passing 0.1 seconds allows non-blocking behavior.
Fill both blanks to set linear and angular velocity from keyboard input.
twist.linear.x = [1] twist.angular.z = [2]
The speed variable controls forward/backward linear velocity, and turn controls rotation (angular velocity).
Fill all three blanks to create a ROS node, initialize it, and set the rate.
rospy.init_node('[1]') rate = rospy.Rate([2]) while not rospy.is_shutdown(): [3]
The node is named teleop_twist_keyboard. The rate is set to 10 Hz. Inside the loop, the velocity command is published with pub.publish(twist).
