bluerobotics / bluerobotics/ping-python

Add instructions on generating new Ping device type

Open
#74 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
60
Forks
39
PR merge metrics
No merged PRs in 30d

Description

There are some users interested in extending Ping-Protocol to support other devices with new messages. I just tested what it would take for a normal user to do that and here are instructions:

Copy message definitions and template from a similar device.
```
cd lib/ping-protocol/src/definitions
cp ping1d.json pinghf.json
cd ../../../../generate
cp ping1d.py.in pinghf.py.in
```

Open `generate-python.py` and add the following to the end:
```
definitionFile = "%s/pinghf.json" % definitionPath
templateFile = "%s/pinghf.py.in" % templatePath
f = open("%s/pinghf.py" % args.output_directory, "w")
f.write(g.generate(definitionFile, templateFile, {"structToken": struct_token}))
f.close()
```

Generate the new files:
```
python3 generate/generate-python.py --output-directory brping
```

Now in `python3` you can `from brping import pinghf`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.