def test_home(): control.setup() # TBD expected_output = None output = control.home() assert output == expected_output, "output and expected_output don't match"
def main(): rospy.init_node("robot_controller", disable_signals=True) rospy.loginfo(f"Node de controle iniciado {rospy.get_time()}") rate = rospy.Rate(CONTROL_RATE) setup() while not rospy.is_shutdown(): loop() rate.sleep()
def test_interact(): control.setup() control.home() # TBD func_input = None # TBD expected_output = None output = control.interact(func_input) assert output == expected_output, "output and expected_output don't match"
def flask_app_launch(**kwargs): """Launches the flask application server. Keyword Arguments ----------------- **host: the host to attach the web server (default 0.0.0.0). **port: the port to attach the web server (default 8080). **debug: whether to switch to debug mode or not. """ print("Setting up components") control.setup() host_ = kwargs.get('host', '0.0.0.0') port_ = kwargs.get('port', 8080) debug_ = kwargs.get('debug', True) app.run(host=host_, port=port_, debug=debug_, threaded=True)
def main(): listener = GripBotListener() controller = Leap.Controller() controller.add_listener(listener) control.setup() thread = threading.Thread(target=sample) thread.start() print "Press Enter to quit..." try: sys.stdin.readline() except KeyboardInterrupt: pass finally: controller.remove_listener(listener) done = True
def startControl(): global root root.withdraw() #hide the root Tk instance (the current window) control.setup() #setup control (import the config and create a clientsocket) controlWindow = rootTopLevel(root) #create a toplevel to hold the control gui control.initTk(controlWindow) #initialize the control tkinter gui using the Toplevel just created as the parent
#!/usr/bin/env python import time import control ser = control.setup() ser.write('90,90,90,90,0\n') # Main loop while True: next = raw_input('Q/W/A/S for in, E/R/D/F for out ') next = next.upper()[0] if next == 'W': speeds = '80,90,90,90,0\n' if next == 'Q': speeds = '90,100,90,90,0\n' if next == 'S': speeds = '90,90,100,90,0\n' if next == 'A': speeds = '90,90,90,80,0\n' if next == 'R': speeds = '100,90,90,90,0\n' if next == 'E': speeds = '90,80,90,90,0\n' if next == 'F': speeds = '90,90,80,90,0\n' if next == 'D': speeds = '90,90,90,100,0\n' ser.write(str(speeds)) time.sleep(0.5) ser.write('90,90,90,90,0\n')
import control CONTENT = """\ HTTP/1.0 200 OK """ file = open("index.html","r") CONTENT += file.read() ai = socket.getaddrinfo("192.168.4.1",8080) addr = ai[0][4] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(addr) s.listen(5) control.setup() while True: res = s.accept() client_s = res[0] client_addr = res[1] print("Client address:", client_addr) print("Client socket:", client_s) print("Request:") req = client_s.recv(4096) print(req) parts = req.decode('ascii').split(' ') if len(parts) > 1: if parts[1] == '/control': client_s.close() values = req.decode('ascii').split('dataforcontrol')[1].split(',')
class StaticResource(object): """ Simple Falcon class to serve the static files needed for the web interface. """ def on_get(self, req, resp, filename): resp.status = falcon.HTTP_200 resp.content_type = "text/html" fn = path.join("frontend", filename) print(fn) with open(fn, 'r') as f: resp.body = f.read() api = application = falcon.API() pipelines, pipelines_meta, srt_passphrase = control.setup() srt_watcher_thread = SRTThread( passphrase=srt_passphrase, srt_destination="srt://localhost:6000?mode=caller") srt_watcher_thread.daemon = True srt_watcher_thread.start() srt_protocol, srt_hostname, srt_port = re.split('://|:', pipelines["output1"].url) srtla_ips_path, srtla_ip_addrs = srtla_ip_setup() print("srtla ips:", srtla_ips_path) control.setup_source_routing(srtla_ip_addrs.keys(), debug=True) control.set_clocks(debug=True)