dji-sdk / RoboMaster-SDK

DJI RoboMaster Python SDK and Sample Code for RoboMaster EP.
Apache License 2.0
311 stars 142 forks source link

IR beams protocol #25

Open Shifuman opened 3 years ago

Shifuman commented 3 years ago

Hello, I am unable to find explanation about the fire beam IR protocol. Could you describe it please to be able to interact with your product, please. Thank you.

brunoga commented 3 years ago

As I understand it, it only works with the binary protocol, not the text mode one (there was no way to set the fire mode to IR with the text mode protocol last time I checked). This example shows how to do it (you want to look for blaster.INFRARED_FIRE):

https://github.com/dji-sdk/RoboMaster-SDK/blob/master/examples/06_blaster/01_fire.py

Shifuman commented 3 years ago

Misunderstood, I mean there is no description of the raw ir protocol of the beam :

I have found at least 4 differents data send by the robomaster by capturing and decoding the IR beam when firing. So I have reproduce the data and was able to deactivate the robomaster. It works but I want to understand (!)

brunoga commented 3 years ago

Misunderstood, I mean there is no description of the raw ir protocol of the beam :

  • What is the length of the beam (32bits seemingly)
  • Prefix / suffix of the code message
  • data signification

I have found at least 4 differents data send by the robomaster by capturing and decoding the IR beam when firing. So I have reproduce the data and was able to deactivate the robomaster. It works but I want to understand (!)

I guess we have an X/Y problem here. Why don't you say what is your objective with that? In any case, the code that fires the IR and that detects IR is here:

Firing: https://github.com/dji-sdk/RoboMaster-SDK/blob/e18bd8ca53b56384101329d21ca995a5a7e69fcb/src/robomaster/blaster.py#L41

Detecting: https://github.com/dji-sdk/RoboMaster-SDK/blob/e18bd8ca53b56384101329d21ca995a5a7e69fcb/src/robomaster/armor.py#L95

You do not really need to know anything more than that to handle firing/detecting IR.

brunoga commented 3 years ago

Ah, wait. You want to decode the IR signal itself. Well, the SDK can not help you with that as it is a completelly different and higher-level abstraction.

Shifuman commented 3 years ago

Yes, that's it. I wanted to interact with the Robomaster with just the IR beam, and I did it. I have catched the IR signal sent by the Robomaster and sent it with another device. By this way, I can play with my son by deactivating his Robomaster (with a IR gun). I have seen that there is some different msg sent through the IR beam and we have to send a different IR msg than the actual emitted by the Robomaster. But to do it well, I wanted some documentation. Actually, it works. But there is maybe some functionalities which can be used by the IR beam emitter/receiver.