To see more examples, check out the Wiki
- Run
make setup
oretc/setup.sh
(if make is not yet installed) to install a full dev environment.- Note that on Raspberry Pi, Nvidia Jetson, etc. only a minimal environment is installed.
- Try out
go run web/cmd/server/main.go robots/configs/fake.json
and visit http://localhost:8080
- Write tests!
- Follow this Go Style Guide
- Always run
make lint
and test before pushing.make build
should be run ifcontrol.js
or proto files have changed.make setup
should be run if any dependencies have changed (run it once per PR to check), but does not need to be run otherwise. - If
control.js
,webappindex.html
or proto files have changed, double check the UI still works through the instructions in here - Usually merge and squash your PRs and more rarely do merge commits with each commit being a logical unit of work.
- If you add a new package, please add it to this README.
- If you add a new sample or command, please add it to this README.
- Experiments should go in samples or any subdirectory with /samples/ in it. As "good" pieces get abstracted, put into a real package command directory.
- Use imperative mood for commits (see Git Documentation).
- Try to avoid large merges unless you're really doing a big merge. Try to rebase (e.g.
git pull --rebase
). - Delete any non-release branches ASAP when done, or use a personal fork
- Prefer metric SI prefixes where possible (e.g. millis) https://www.nist.gov/pml/weights-and-measures/metric-si-prefixes. The type of measurement (e.g. meters) is not necessary if it is implied (e.g. rulerLengthMillis).
All resources implemented within the RDK follow the pattern of registering themselves within an func init()
block. This requires the package they are implemented in be imported, but typically not explicitly used. The place where we currently put blank imports (_ "pkgpath"
) is in the corresponding resource's register package.
For API intercommunication, we use Protocol Buffers to serialize data and gRPC to communicate it. For more information on both technologies, see https://developers.google.com/protocol-buffers and https://grpc.io/.
Some guidelines on using these:
- Follow the Protobuf style guide.
- After making changes to a
.proto
file, make sure to runmake buf
to generate new files. Make sureprotoc-gen-go-grpc
andprotoc-gen-go
, usually located in~/go/bin
, are in your$PATH
.
Let's assume big data is > 10KiB. This kind of data is annoying to slow to pull down with git and is typically not needed except for certain tests. In order to add large data test artifacts, you need to do the following:
# get ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS by talking to Eliot or Eric
# export the path with the json file as an environment variable:
export ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/json/credentials
go install go.viam.com/utils/artifact/cmd/artifact
# place new artifacts in ./artifact/data
artifact push
git add .artifact
# commit the file at some point
General workflow:
- Add your file of interest to the
.artifact/data
directory, wherever you want. You can even make a new folder for it. artifact push
to create an entry for it in.artfact/tree.json
artifact pull
to download all the files that are in thetree.json
file