jeguzzi / robomaster_sim

A simulator/emulator of DJI Robomaster Robots (EP and S1)
MIT License
21 stars 2 forks source link

ep_robot.sensor.sub_distance returns [0,0,0,0] #1

Closed cjinchi closed 2 years ago

cjinchi commented 2 years ago

Hi there,

This is an awesome project! I think it is very useful for simulated experiments. I have a RoboMaster EP with four tof sensors installed on the front, back, left, and right. With the following API in RoboMaster SDK, I can read the real-time distances. ep_robot.sensor.sub_distance(callback=foo_bar) I tried the same code snippet in this simulator, but the readings are always [0,0,0,0]. Is it because I didn’t configure the simulator properly? If not, could you please tell me which modules should be revised to implement it? I tried to read the source code but failed to get an overview. Thank you.

Best wishes

jeguzzi commented 2 years ago

Thank you.

I assume you are using CoppeliaSim, not the dummy simulation. Anyway, I implemented the protocol for distance sensors but I have not added the actual sensors to the coppeliaSim model, so that right now it returns the zeros you are getting.

It's totally feasible to add the sensors to the coppeliaSim model and then complete the plugin CoppeliaSimRobot::read_tof() method.

You would also need to modify the constructor so to pass the (coppeliaSim) handles of the sensors you are using, so to query them in the method above.

I plan to do it in the near future.

jeguzzi commented 2 years ago

I added the distance sensors. See the README and the two scene playground_tof_ep and playground_tof_s1.