Please select Into the mobile phone version | Continue to access the computer ver.
Possible to automatically connect via SDK?
629 1 2-16 14:04
Uploading and Loding Picture ...(0/1)
o(^-^)o
jam_
lvl.1
Flight distance : 8773 ft
United States
Offline

I'd like to have my RoboMaster EP automatically connect to a running application on my local network as soon as it comes online. My application can manage the connection state, continuously scan for a device, or do whatever it needs to.

It seems like it may be necessary, though, to scan the QR code every single time the device comes online. Has anyone figured out a way around that?
2-16 14:04
Use props
jam_
lvl.1
Flight distance : 8773 ft
United States
Offline

Turns out I glossed over the "tip" section in the documentation. Here's a way to automatically connect to the robot when it comes online:

        # Try to find online robots
        while True:
            print("INFO: scanning...")
            scan_result = conn.scan_robot_ip_list(timeout=3)
            if len(scan_result) == 0:
                continue

            # Get the robot's sn
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            s.bind(("0.0.0.0", robomaster.config.ROBOT_BROADCAST_PORT))
            s.settimeout(1)
            data, ip = s.recvfrom(1024)
            robot_sn = conn.get_sn_form_data(data)
            s.close()
            time.sleep(1)

            # Set up the robot        
            self.ep_robot = robot.Robot()
            self.ep_robot.initialize(conn_type="sta", sn=robot_sn)


2-18 08:35
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules