-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.py
More file actions
30 lines (24 loc) · 827 Bytes
/
action.py
File metadata and controls
30 lines (24 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import socket
import sys
import time
from zss_cmd_pb2 import Robots_Command, Robot_Command
class Action(object):
def __init__(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.command_address = ('localhost', 50001)
def sendCommand(self, vx=0, vy=0, vw=0):
commands = Robots_Command()
command = commands.command.add()
command.robot_id = 0
command.velocity_x = vx
command.velocity_y = vy
command.velocity_r = vw
command.kick = False
command.power = 0
command.dribbler_spin = False
self.sock.sendto(commands.SerializeToString(), self.command_address)
if __name__ == '__main__':
action_module = Action()
while True:
action_module.sendCommand(vx=100, vw=10)
time.sleep(0.02)