Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update API between DonkeyCar and MM1 #10

Open
mockbot opened this issue Dec 21, 2020 · 3 comments
Open

update API between DonkeyCar and MM1 #10

mockbot opened this issue Dec 21, 2020 · 3 comments

Comments

@mockbot
Copy link

mockbot commented Dec 21, 2020

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.

@wallarug
Copy link
Member

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.

@mockbot
Copy link
Author

mockbot commented Dec 21, 2020

I like pymata_rh very much, but it has too many dependencies from other developers and ideas.

@mockbot
Copy link
Author

mockbot commented Dec 21, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants