CES2023
Simple Maneuverability Instructions for Mini Zetabot
control.ipynb
Running the cell code Ctrl + Enter
Jupyter notebook with instructions for Forwards, Backwards, and Rotational movements
import rospy
import json
from std_msgs.msg import String, Int32MultiArray
import time
import math
Import in the necessary python libraries
move_pub = rospy.Publisher('/robot_command', String, queue_size=1)
sound = Int32MultiArray()
sound_pub = rospy.Publisher('robot_sound',Int32MultiArray, queue_size=1)
rospy.init_node('zetabot', anonymous=True)
time.sleep(1)
Initialize zetabot as an object
def Forward():
tmp = {"MoveDelta": 0.5}
msg = json.dumps(tmp)
rospy.loginfo("Sent: %s", msg)
sound.data=[1,1,2]
sound_pub.publish(sound)
move_pub.publish(msg)
Move the robot Forward for delta amount
Forward()
def Backward():
tmp = {"MoveDelta": -0.5}
msg = json.dumps(tmp)
rospy.loginfo("Sent: %s", msg)
sound.data=[1,0,2]
sound_pub.publish(sound)
move_pub.publish(msg)
Move the robot Backward for delta amount
Backward()
def Rotation():
tmp = {"TurnDelta": math.radians(180)}
msg = json.dumps(tmp)
rospy.loginfo("Sent: %s", msg)
sound.data=[1,2,2]
sound_pub.publish(sound)
move_pub.publish(msg)
Rotate the robot with a given radius. (example 180 degrees)
Rotation()
def stop():
tmp = {"Stop": 0}
msg = json.dumps(tmp)
rospy.loginfo("Sent: %s", msg)
move_pub.publish(msg)
Terminate the movement of the robot
stop()