diff --git a/makefile b/makefile new file mode 100644 index 0000000..b07ee85 --- /dev/null +++ b/makefile @@ -0,0 +1,14 @@ +BINARY_NAME=motorsim +SRC_PATH=./src + +all: generate-protos build + +build: + go build -o ${BINARY_NAME} ${SRC_PATH}/main.go + +generate-protos: + protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative ${SRC_PATH}/motorsim.proto + +clean: + go clean + rm ${BINARY_NAME} ./src/*.pb.go \ No newline at end of file diff --git a/src/motorsim.proto b/src/motorsim.proto new file mode 100644 index 0000000..a985720 --- /dev/null +++ b/src/motorsim.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +import "google/protobuf/empty.proto"; + +option go_package = ".;motorprotos"; + +package motorprotos; + +// Server converting target angles to velocity profile for mo +service MotorsController { + rpc SetJoints(Angles) returns (Angles) {} + rpc GetJoints(google.protobuf.Empty) returns (Angles) {} +} +// Server converting target angles to velocity profile for mo +//service Motor { +// rpc SetVolicty(Velocity) returns (google.protobuf.Empty) {} +// rpc ReceiveDataStream(google.protobuf.Empty) returns (stream +//} + +message Angles { + repeated double angles = 1; +} + +message Velocity { + double velocity = 1; +} + +message MotorData { + double angle = 1; + double velocity = 2; + string error = 3; // Will be filled if motor encounter an error +} \ No newline at end of file