What did you do
--Connect Robomasters1 to your PC via USB and use adb to access the root. --I took a peek at the file structure of the contents
What can you do?
――I don't know ... (passionate) --You can run the Python environment on the command line without any restrictions (some libraries cannot be used via the app)
What do you want to do
--I want to send a command from a PC to Robomaster S1 and collect images and sensor data Reference: Mr. Ishikawa's article --I want to use it to process Robomaster images on a PC and send control signals like the volunteer Demo.
The ball tracking demo video is attached below. I want to do something like this.
There is a model called EP, which is the successor to Robomaster S1, and you can do what you just said. SDK is also distributed. (Document is here)
https://github.com/dji-sdk/RoboMaster-SDK/tree/master/sample_code
According to Mr. Bruno who is familiar with this matter, this SDK does not originally support S1, but since the configuration is similar, it can be diverted if done well.
reference:
-Bruno's repository -Bruno's DJI Forum
For the time being, root access seems to be required
-Refer to Discussion here Perform root access. --Look into the contents of the System
Connect to Robomasters 1 from your Windows 10 Home PC using the microUSB connector.
I will proceed based on PDF here, but note that it cannot be rooted if the firmware is new. There is a report of, so do not update **.
Prepare the following items.
--PC, microUSB conversion cable
Unzip Platform Tools and remember the location of the folder. Connect your PC to Robomasters 1.
** Please remove the Android device connected to your PC before going to the next step. ** **
Turn on the power of Robomasters1 and start the software on the PC side to connect. (I have a Wifi connection)
Go to the page to write a Python script from "Lab"-> "DIY Programming".
Copy and paste the following code to create a new one and execute it. (It looks like you're hitting sh to enable adb)
def root_me(module):
__import__=rm_log.__dict__['__builtins__']['__import__']
return __import__(module,globals(),locals(),[],0)
builtins=root_me('builtins')
subprocess=root_me('subprocess')
proc=subprocess.Popen('/system/bin/adb_en.sh',shell=True,executable='/system/bin/sh',stdout=subprocess.PIPE,stderr=subprocess.PIPE)
Next, go to the Platform Tools folder (folder where adb can be executed) that you unzipped earlier, and start Powershell. (Terminal for Linux people)
.\adb.exe devices
After executing
.\adb.exe shell
To execute. If all goes well, you should have it as root as shown below.
-~~ Somehow, remove ConnectionRefusedError: [WinError 10061]
on the Robomasters1 side and try the SDK sample program ~~
--Apparently the Robomaster s1 doesn't have the socket port that triggers the SDK, so you need to copy the files from the EP ... you don't have the money to buy the EP either ...
Addendum: Looking at Exchanges here, it seems that you need to copy the files from Robomaster EP, which you can do with your own. That's right ...
Looking at the SDK as of August 12, 2020, it seems that the SDK mode is enabled by sending a signal to a specific port of the Robomasters1 address, and various commands are issued.
For example, in a test file that enables the SDK and executes various instructions from a PC, a signal is sent to port 40923 by socket communication.
# -*- encoding: utf-8 -*-
#Measurement environment: Python 3.6 editions
import socket
import sys
#Under the direct connection model, the robot person's robot IP ground site 192.168.2.1,Control order end mouth number 40923
host = "192.168.100.111"
port = 40923
def main():
address = (host, int(port))
#Robot control person restraint order end entrance erection TCP connection
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("Connecting...")
s.connect(address)
print("Connected!")
while True:
#User import restraint order
msg = input(">>> please input SDK cmd: ")
#At the time of Q or q, before leaving the program
if msg.upper() == 'Q':
break
#Addition cohesion
msg += ';'
#Transmission restraint order
s.send(msg.encode('utf-8'))
try:
#The result of the return of the robot
buf = s.recv(1024)
print(buf.decode('utf-8'))
except socket.error as e:
print("Error receiving :", e)
sys.exit(1)
if not len(buf):
break
#Jacobs bogie connection
s.shutdown(socket.SHUT_WR)
s.close()
if __name__ == '__main__':
main()
However, when connecting from the Client side, the following error is issued.
ConnectionRefusedError: [WinError 10061]The connection could not be made because it was rejected by the target computer.
Do I need to edit hosts or something, or mess with Permission? I'm looking into it for a moment. (I want to learn from someone who is familiar with it.)
Postscript: When I tried it, it seems that the problem is that the Port that is open in EP is not open in S1.
As a basis, I started the following server with Robomaster s1 and confirmed that it can be connected from a PC.
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("192.168.100.111", 1235))
s.listen(5)
timeout=60## run 60 sec
s.settimeout(timeout)
while True:
clientsocket, address = s.accept()
print(f"Connection from {address} has been established!")
clientsocket.send(bytes("Welcome to the server!", 'utf-8'))
clientsocket.close()
print("Exit!")
I'm an amateur of Linux and Hack like this, so it was hard to understand by looking inside. I will post it by the record.
It seems to be a Linux system.
$ cat /proc/version
Linux version 3.10.62 (jenkins@APServer01) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Tue Jul 16 04:08:11 CST 2019
/
I don't know anything, so it feels like I'm looking at this, but I'll make a note of it.
amt
blackbox
cache
data
default.prop
dev
etc
file_contexts
ftp
init
init.environ.rc
init.lc1860.3connective.rc
init.rc
init.trace.rc
init.usb.rc
proc
property_contexts
root
sbin
sdcard
seapp_contexts
sepolicy
sys
system
system.md5
tmp
ueventd.rc
var
vendor
There is a Python folder in data / python_flies
.
The contents of bin are as follows
2to3
idle
pydoc
python
python-config
python3.6m
pyvenv
You can actually do it. The environment seems to be 3.6.
126|root@xw607_dz_ap0002_v4:/data/python_files/bin # ./python
Python 3.6.6 (default, Jul 16 2018, 17:22:20)
[GCC 4.8.3 20140320 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
The difference from the robomaster app is that you can use certain packages.
For example, in the code created by the application, ** socket etc. is played as an error at the time of import, but it can be executed normally by root command line execution. ** **
It would be nice if there was an editor such as vi, but as far as the output of ls / system / bin
is seen, there is no editor, so it seems necessary to transfer files.
If you know where the file created by the application is, it seems that you can operate it to some extent on root.
Omitted tty. There is video0 and so on.
alarm
android_adb
apple_roleswitch
applecp
ashmem
binder
block
bulk_usb
bus
comip-snd-lowpower
comip-ureg
console
cpu_dma_latency
cuse
full
fuse
graphics
hx170dec
hx280enc
hx280enc_h1
i2c-0
i2c-1
i2c-3
i2c-4
input
ion
kmsg
lcmem
log
loop-control
mem
modem
mtp_usb
network_latency
network_throughput
null
on2map
on2psm
ptmx
pts
random
rtc0
sdpr
sdps
snd
socket
spidev0.0
spidev1.0
spidev2.0
uio0
uio1
uio2
urandom
vcs
vcs1
vcsa
vcsa1
video0
zero
Recommended Posts