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

simplify services api #60

Merged
merged 18 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion protos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ farm_ng_add_protobufs(farm_ng_amiga_proto_defs
NAMESPACE farm_ng_amiga
INCLUDE_DIRS
${Sophus_PROTO_DIR}
${farm_ng_core_PROTO_DIR}
PROTO_FILES
farm_ng/oak/oak.proto
farm_ng/canbus/canbus.proto
farm_ng/oak/oak.proto
farm_ng/service/service.proto
DEPENDENCIES
Sophus::sophus_linalg_proto_defs
Sophus::sophus_lie_proto_defs
farm_ng_core::farm_ng_core_proto_defs
)
65 changes: 3 additions & 62 deletions protos/farm_ng/canbus/canbus.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.



syntax = "proto3";

package farm_ng.canbus.proto;
Expand All @@ -22,42 +20,22 @@ service CanbusService {
rpc streamCanbusMessages(StreamCanbusRequest)
returns (stream StreamCanbusReply) {}
rpc sendCanbusMessage(stream SendCanbusMessageRequest)
returns (SendCanbusMessageReply) {}
rpc getServiceState(GetServiceStateRequest) returns (GetServiceStateResult) {}
rpc startService(StartServiceRequest) returns (StartServiceResult) {}
rpc stopService(StopServiceRequest) returns (StopServiceResult) {}
rpc pauseService(PauseServiceRequest) returns (PauseServiceResult) {}
}

enum ReplyStatus {
OK = 0;
FAILED = 1;
}

enum CanbusServiceState {
UNKNOWN = 0;
STOPPED = 1;
RUNNING = 2;
IDLE = 3;
UNAVAILABLE = 4;
ERROR = 5;
returns (stream SendCanbusMessageReply) {}
}

message StreamCanbusRequest {
string message = 1;
}

message StreamCanbusReply {
ReplyStatus status = 1;
RawCanbusMessages messages = 2;
RawCanbusMessages messages = 1;
}

message SendCanbusMessageRequest {
RawCanbusMessage message = 1;
}

message SendCanbusMessageReply {
ReplyStatus status = 1;
bool success = 1;
}

message RawCanbusMessage {
Expand All @@ -73,40 +51,3 @@ message RawCanbusMessage {
message RawCanbusMessages {
repeated RawCanbusMessage messages = 1;
}

message StartServiceRequest {
string message = 1;
}

message StopServiceRequest {
string message = 1;
}

message PauseServiceRequest {
string message = 1;
}

message StartServiceResult {
string message = 1;
ReplyStatus status = 2;
}

message StopServiceResult {
string message = 1;
ReplyStatus status = 2;
}

message PauseServiceResult {
string message = 1;
ReplyStatus status = 2;
}

message GetServiceStateRequest {
string message = 1;
}

message GetServiceStateResult {
string state_name = 1;
CanbusServiceState state = 2;
ReplyStatus status = 3;
}
77 changes: 9 additions & 68 deletions protos/farm_ng/oak/oak.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,100 +12,42 @@
// See the License for the specific language governing permissions and
// limitations under the License.



syntax = "proto3";

import "farm_ng/service/service.proto";
Hackerman342 marked this conversation as resolved.
Show resolved Hide resolved

package farm_ng.oak.proto;

service OakService {
rpc cameraControl(CameraControlRequest) returns (CameraControlReply) {}
rpc streamFrames(StreamFramesRequest) returns (stream StreamFramesReply) {}
rpc getServiceState(GetServiceStateRequest) returns (GetServiceStateResult) {}
rpc startService(StartServiceRequest) returns (StartServiceResult) {}
rpc stopService(StopServiceRequest) returns (StopServiceResult) {}
rpc pauseService(PauseServiceRequest) returns (PauseServiceResult) {}
rpc getCalibration(GetCalibrationRequest) returns (GetCalibrationResult) {}
}

enum ReplyStatus {
OK = 0;
FAILED = 1;
}

enum OakServiceState {
UNKNOWN = 0;
STOPPED = 1;
RUNNING = 2;
IDLE = 3;
UNAVAILABLE = 4;
rpc getCalibration(GetCalibrationRequest) returns (GetCalibrationReply) {}
}

message GetCalibrationRequest {
string message = 1;
}

message GetCalibrationResult {
message GetCalibrationReply {
OakCalibration calibration = 1;
ReplyStatus status = 2;
}

message StopServiceRequest {
string message = 1;
}

message StopServiceResult {
string message = 1;
ReplyStatus status = 2;
}

message StartServiceRequest {
string message = 1;
}

message StartServiceResult {
string message = 1;
ReplyStatus status = 2;
}

message PauseServiceRequest {
string message = 1;
}

message PauseServiceResult {
string message = 1;
ReplyStatus status = 2;
}

message GetServiceStateRequest {
string message = 1;
}

message GetServiceStateResult {
string state_name = 1;
OakServiceState state = 2;
ReplyStatus status = 3;
}

message CameraControlRequest {
CameraSettings stereo_settings = 1;
CameraSettings rgb_settings = 2;
}


message CameraControlReply {
ReplyStatus status = 1;
CameraSettings stereo_settings = 2;
CameraSettings rgb_settings = 3;
bool success = 1;
CameraSettings stereo_settings = 2;
CameraSettings rgb_settings = 3;
}

message StreamFramesRequest {
int32 every_n = 1; // desired stream frame rate.
}

message StreamFramesReply {
ReplyStatus status = 1;
OakSyncFrame frame = 2;
OakSyncFrame frame = 1;
}

message Vec3F32 {
Expand All @@ -124,7 +66,7 @@ message CameraSettings {
message OakImageMeta {
int64 category = 1; // DepthAI catetory
int64 instance_num = 2; //DepthAI instance number
int64 sequence_num = 3; // for synchronization between left, right and stereo
int64 sequence_num = 3; // for synchronization between left, right and stereo
double timestamp = 4; // seconds, synchronized with host monotonic
double timestamp_device = 5; // seconds, device monotonic clock
CameraSettings settings = 6;
Expand Down Expand Up @@ -216,7 +158,6 @@ message Extrinsics {
Vector3d translation = 4;
}


message CameraData {
uint32 camera_number = 1;
int32 camera_type = 2;
Expand Down
46 changes: 46 additions & 0 deletions protos/farm_ng/service/service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) farm-ng, inc.
//
// Licensed under the Amiga Development Kit License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://github.com/farm-ng/amiga-dev-kit/blob/main/LICENSE
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

import "farm_ng/core/timestamp.proto";

package farm_ng.service.proto;

service Service {
rpc getServiceState(GetServiceStateRequest) returns (GetServiceStateReply) {}
}

enum ServiceState {
// Service state is not known
UNKNOWN = 0;
// Running, and actively serving data
RUNNING = 1;
// Idle, waiting for clients
IDLE = 2;
// Service isn't running at all
UNAVAILABLE = 3;
// Service is in some error state
ERROR = 4;
}

message GetServiceStateRequest {
}

message GetServiceStateReply {
ServiceState state = 1;
uint32 pid = 2; // process id
double uptime = 3;
Hackerman342 marked this conversation as resolved.
Show resolved Hide resolved
repeated farm_ng.core.proto.Timestamp timestamps = 4;
}
Loading