DSP file codec.
7138 16 2019-11-13
Uploading and Loding Picture ...(0/1)
o(^-^)o
BGA
lvl.4
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: 20

DSP Codec for Linux (64 bits)

dsp_codec_darwin.zip

1.63 MB, Down times: 26

DSP Codec for MacOS (64 bits)

dsp_codec_windows.zip

1.65 MB, Down times: 98

DSP Codec for Windows (64 bits)

2019-11-13
Use props
sevreNniarB
lvl.3
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
Administrator

Offline

Thanks for sharing your this informative thread to our valued DJI Forum members! Nice work.
2019-11-13
Use props
BGA
lvl.4
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.3
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.2
Flight distance : 26401 ft
Japan
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.2
Flight distance : 26401 ft
Japan
Offline

Would you e willing to open source this dsp_codec?
2019-12-30
Use props
BGA
lvl.4
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
lvl.4
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
felixladeia
lvl.1
Japan
Offline

Hello BGA! Thank you for all your effort.
I have great interest in the DSP modules creation.
I have tried to access your repository link
https://git.bug-br.org.br/bga/robomasters1/src/master/dsp
but it seems to be offline. Is it possible to make it available again?

Thank you very much
2020-12-2
Use props
BGA
lvl.4
United States
Offline

felixladeia Posted at 12-2 17:02
Hello BGA! Thank you for all your effort.
I have great interest in the DSP modules creation.
I have tried to access your repository link

Site is back up.
2020-12-4
Use props
5GEF
lvl.1
Italy
Offline

sevreNniarB Posted at 2019-11-14 14:08
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).

I know that is one year older question, but if someone else try to read or write unecrypted files, try to use adb pull / adb push instead ftp, is working fine and the file are readable (I'm using Ubuntu18.04 on my laptop)
2021-1-12
Use props
yctm
New

Hong Kong
Offline

thanks for share
2021-9-8
Use props
fans37545e4d
New

United States
Offline

Thanks! Just works for me!
2021-12-11
Use props
fansef074035
New

Australia
Offline

I am not sure why I get the message "You do not have permission to download this attachment" when I click on the Mac codec. The github link below also gives me a 404 error. Any chance I could download the codec differently? I would love to make some code available to my high school students.
2022-1-25
Use props
BGA
lvl.4
United States
Offline

fansef074035 Posted at 1-25 16:50
I am not sure why I get the message "You do not have permission to download this attachment" when I click on the Mac codec. The github link below also gives me a 404 error. Any chance I could download the codec differently? I would love to make some code available to my high school students.

I thought I have lost all of this code but fortunately I found someone who copied it to Github and now I imported it back to my repository there. The code can be found here:

https://github.com/brunoga/robomaster/tree/master/legacy/dsp
2022-1-29
Use props
ro_flyer
Second Officer
Flight distance : 7557283 ft
Brazil
Offline

BGA Posted at 2019-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.

2022-3-5
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules