Add makefile & intial Proto
This commit is contained in:
parent
b0a9be04aa
commit
088775dcbc
2 changed files with 46 additions and 0 deletions
14
makefile
Normal file
14
makefile
Normal file
|
@ -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
|
32
src/motorsim.proto
Normal file
32
src/motorsim.proto
Normal file
|
@ -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
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue