Please select Into the mobile phone version | Continue to access the computer ver.
DSP file codec.
1180 8 2019-11-13
Uploading and Loding Picture ...(0/1)
o(^-^)o
BGA
First Officer
United States
Offline

We now have a fully working tool to read/write .dsp files. This means that we can create Python programs outside of the DIY Lab, run the tool on the program file and directly import it in the Lab (no need to copy and paste anything). Usage is pretty straight forward.

Usage: dsp_codec filename
  -creator string
            program creator (default "Anonymous")
  -raw
            read/write raw file
  -title string
            program title (default "Untitled")


Non-raw mode will automatically decode any .dsp file given to it (and write a .py file with the code) and will encode any .py file in a .dsp file (setting the creator and title based on the other flags). Raw mode lets you wrap/unwrap any arbitrary file inside a .dsp file (if you apply it to an existing DSP file, you can check the internal XML file that is used for Robomaster Programs), mostly for debugging as sending random files to the Robomaster S1 is not a good idea (will not do anything in the best case scenarion and crash it in the worst case scenario).

Attached are zip files with versions for Linux, Windows and MacOS (all 64 bits). If you need a version for a different platform let me know and I can provide it.

Please report any issues. I really only tested the Linux version.

dsp_codec_linux.zip

1.62 MB, Down times: 8

DSP Codec for Linux (64 bits)

dsp_codec_darwin.zip

1.63 MB, Down times: 13

DSP Codec for MacOS (64 bits)

dsp_codec_windows.zip

1.65 MB, Down times: 52

DSP Codec for Windows (64 bits)

2019-11-13
Use props
sevreNniarB
lvl.4
Germany
Offline

Great, thank you BGA!

Will test it on Windows, hope my battery will be recharged soon

Cheers
2019-11-13
Use props
DJI Tony
Super Moderator

Offline

Thanks for sharing your this informative thread to our valued DJI Forum members! Nice work.
2019-11-13
Use props
BGA
First Officer
United States
Offline

sevreNniarB Posted at 11-13 13:59
Great, thank you BGA!

Will test it on Windows, hope my battery will be recharged soon

Did you try it out?

In any case, I am now working a library to allow external control of the S1 using the UDP-based protocol currently used by the app. This most likely will not give us a lot of control (at least not more control than the app itself has), but would allow direct control of the S1. If i can manage to also get the video feed out of it, we might even do image recognition from the outside which would open up some cool things.
2019-11-14
Use props
sevreNniarB
lvl.4
Germany
Offline

BGA Posted at 11-14 09:48
Did you try it out?

In any case, I am now working a library to allow external control of the S1 using the UDP-based protocol currently used by the app. This most likely will not give us a lot of control (at least not more control than the app itself has), but would allow direct control of the S1. If i can manage to also get the video feed out of it, we might even do image recognition from the outside which would open up some cool things.

Works perfect, thank you again for your effort!

Well, I could help a bit with the UDP stuff There is a file called wifi_debug (don't fiddle with the script itself, it's a checksumed one), I'm not at my S1 PC right now, but you will find it. MKDIR the needed subfolder (s. script for the name, it's usb[something] in /data and just echo anything > wifi.debug file into that new folder (to create the hard-checked file).

Run the mentioned script and it will start capturing the traffic and generates a perfect pcap file. Maybe it's better to symlink it to the sd card, those captures can get really big sometimes.

Just a side note: FTP wget from the S1 is encrypted too, they use a modified busybox version. However, the key (or part of it) can be find using the SET command. Maybe you wanna take a look at it? The provided key is imho not complete, maybe the rest is coming from the boards serial# or something... would be nice to unscramble the downloaded FTP files...

GL with it

Cheers
2019-11-14
Use props
radusl
lvl.1
Flight distance : 26401 ft
Norway
Offline

This is really awesome work BGA.
If you manage to create a library to allows for external control of the S1 and at the same time manage to get the video (and maybe sensors data) feed out of it, then i am very interested in this library.
My plan is to to create a reinforcement machine learning model that would allow the S1 to do some really cool stuff. The ML model would process the data coming from S1 (video and sensors) on the PC on the GPU and then control the S1 by returning the commands back to it.
Please share the library if you manage to hack it. That would really open up some interesting opportunities.
2019-12-30
Use props
radusl
lvl.1
Flight distance : 26401 ft
Norway
Offline

Would you e willing to open source this dsp_codec?
2019-12-30
Use props
BGA
First Officer
United States
Offline

radusl Posted at 12-30 06:55
This is really awesome work BGA.
If you manage to create a library to allows for external control of the S1 and at the same time manage to get the video (and maybe sensors data) feed out of it, then i am very interested in this library.
My plan is to to create a reinforcement machine learning model that would allow the S1 to do some really cool stuff. The ML model would process the data coming from S1 (video and sensors) on the PC on the GPU and then control the S1 by returning the commands back to it.

All of this is technically possible. The method I am using will give any programs as much access as the official DJI app has to the robot. Right now I only figured out the video part (mostly because it seemed the most interesting one) but I will look into actually controlling the robot next.

Because this is a work in progress the code is mostly a mish-mash of hacked up together things but it should evolve to something more manageable eventually.

And it is already available as it is on my repository. You can get it there and play with it.
2019-12-30
Use props
BGA
First Officer
United States
Offline

radusl Posted at 12-30 07:04
Would you e willing to open source this dsp_codec?

I do not do closed-source stuff. The code is and always was fully available on my repository:

https://git.bug-br.org.br/bga/robomasters1/src/master/dsp
2019-12-30
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules