Open mockbot opened 3 years ago
Hi @mockbot
The Donkey Car Environment doesn't currently support JSON transfers between any parts. It would not be standard and would require a lot of extra work.
How did you go with testing the Pymata things? That would be easier to integrate, but not immediately.
I am currently waiting for the Donkey Car Maintainers to push through a big Pull Request before making any more changes to the Robo HAT parts.
I like pymata_rh very much, but it has too many dependencies from other developers and ideas.
this is the key part of action :-) if(len(datastr) >= 10): steering_val = steering.value throttle_val = throttle.value try: steering_val = int(datastr[:4]) throttle_val = int(datastr[-4:])
this must be replaced by simple json encode/decode feature... at micropython and mm1-part
while True: json_string = sio.readline() try: data = json.loads(json_string) if enable_stdio == 1: print(data["serial"],data["gyro"],data["accel"],data["magnetic"],data["temperature"],data["vshunt"],data["vbus"],data["current"],data["nmea"]) except: print("ERROR:"+str(err)+" json decode error !!!") err=err+1
Hello again,
the current API between DonkeyCar and MM1 is too weak to support all fantasitic MM1 features. Why not using a similar API like GYM part and remote DCsimulator ? Instead of exchanging throttle and steering only, exchange simple JSON data in both directions. The API may be extended very easy to support additional features of MM1.
PoC exchange json :: https://github.com/mockbot/SerialJsonGW/blob/master/MM1JsonAgent.py
TODO: more reliable serial communication in both directions.