Skip to content

Commit

Permalink
tentative manual merge with develop, conflicts in .proto resolved by …
Browse files Browse the repository at this point in the history
…keeping everything from woth sides
  • Loading branch information
RemiFabre committed Sep 20, 2024
2 parents a09cf10 + 6e6e54e commit fbd0786
Show file tree
Hide file tree
Showing 58 changed files with 7,212 additions and 1,800 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/generate_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

name: Generate Code

on: [push]

jobs:
generate-python:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install grpcio-tools==1.59.3 mypy-protobuf==3.5.0
- name: Generate Protobuf Python Code
run: |
python -m grpc_tools.protoc -I./protos --python_out=./python/reachy2_sdk_api --grpc_python_out=./python/reachy2_sdk_api --mypy_out=./python/reachy2_sdk_api --mypy_grpc_out=./python/reachy2_sdk_api ./protos/*.proto
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Generated Protobuf Python Code" || echo "No changes to commit"
git push
generate-csharp:
runs-on: windows-2022
needs: generate-python

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[17.10,17.11)'

- name: Restore NuGet packages
run: nuget restore 'csharp/reachy_sdk/reachy_sdk.sln'

- name: Build solution
run: msbuild 'csharp\reachy_sdk\reachy_sdk.sln' /p:Configuration=Release

- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Generated Protobuf C# Code" || echo "No changes to commit"
git push
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Protobuf for Reachy 2 SDK

## Generate gRPC code

Code for Python and C# is generated automatically by the CI. You just need to `git pull` to get the generated code after any pushed changes to the .proto. If you still need to generate these files locally, you can do the following commands

### For Python:

Install `pip install mypy-protobuf` to generate the mypy stubs
Just install `pip install mypy-protobuf` to generate the mypy stubs, and run:

```python
python -m grpc_tools.protoc -I./protos --python_out=./python/reachy2_sdk_api --grpc_python_out=./python/reachy2_sdk_api --mypy_out=./python/reachy2_sdk_api --mypy_grpc_out=./python/reachy2_sdk_api ./protos/*.proto
```

### For C#

On a Windows computer, open `reachy_sdk.sln`` in Visual Studio.
`Click Build > Build Solution`
Open `reachy_sdk.sln` in Visual Studio, and `Click Build > Build Solution`
967 changes: 859 additions & 108 deletions csharp/Arm.cs

Large diffs are not rendered by default.

538 changes: 501 additions & 37 deletions csharp/Goto.cs

Large diffs are not rendered by default.

195 changes: 133 additions & 62 deletions csharp/Hand.cs

Large diffs are not rendered by default.

397 changes: 293 additions & 104 deletions csharp/Head.cs

Large diffs are not rendered by default.

171 changes: 110 additions & 61 deletions csharp/MobileBaseLidar.cs

Large diffs are not rendered by default.

88 changes: 44 additions & 44 deletions csharp/MobileBaseLidarGrpc.cs

Large diffs are not rendered by default.

287 changes: 216 additions & 71 deletions csharp/MobileBaseMobility.cs

Large diffs are not rendered by default.

128 changes: 83 additions & 45 deletions csharp/MobileBaseMobilityGrpc.cs

Large diffs are not rendered by default.

1,026 changes: 719 additions & 307 deletions csharp/MobileBaseUtility.cs

Large diffs are not rendered by default.

492 changes: 356 additions & 136 deletions csharp/MobileBaseUtilityGrpc.cs

Large diffs are not rendered by default.

855 changes: 813 additions & 42 deletions csharp/Reachy.cs

Large diffs are not rendered by default.

68 changes: 67 additions & 1 deletion csharp/ReachyGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, gl
static readonly grpc::Marshaller<global::Reachy.ReachyState> __Marshaller_reachy_ReachyState = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Reachy.ReachyState.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Reachy.ReachyStreamStateRequest> __Marshaller_reachy_ReachyStreamStateRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Reachy.ReachyStreamStateRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Reachy.ReachyStatus> __Marshaller_reachy_ReachyStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Reachy.ReachyStatus.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Reachy.ReachyStreamAuditRequest> __Marshaller_reachy_ReachyStreamAuditRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Reachy.ReachyStreamAuditRequest.Parser));

[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Reachy.Reachy> __Method_GetReachy = new grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Reachy.Reachy>(
Expand All @@ -80,6 +84,22 @@ static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, gl
__Marshaller_reachy_ReachyStreamStateRequest,
__Marshaller_reachy_ReachyState);

[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::Reachy.ReachyId, global::Reachy.ReachyStatus> __Method_Audit = new grpc::Method<global::Reachy.ReachyId, global::Reachy.ReachyStatus>(
grpc::MethodType.Unary,
__ServiceName,
"Audit",
__Marshaller_reachy_ReachyId,
__Marshaller_reachy_ReachyStatus);

[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::Reachy.ReachyStreamAuditRequest, global::Reachy.ReachyStatus> __Method_StreamAudit = new grpc::Method<global::Reachy.ReachyStreamAuditRequest, global::Reachy.ReachyStatus>(
grpc::MethodType.ServerStreaming,
__ServiceName,
"StreamAudit",
__Marshaller_reachy_ReachyStreamAuditRequest,
__Marshaller_reachy_ReachyStatus);

/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
Expand Down Expand Up @@ -108,6 +128,18 @@ public abstract partial class ReachyServiceBase
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}

[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::System.Threading.Tasks.Task<global::Reachy.ReachyStatus> Audit(global::Reachy.ReachyId request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}

[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::System.Threading.Tasks.Task StreamAudit(global::Reachy.ReachyStreamAuditRequest request, grpc::IServerStreamWriter<global::Reachy.ReachyStatus> responseStream, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}

}

/// <summary>Client for ReachyService</summary>
Expand Down Expand Up @@ -187,6 +219,36 @@ protected ReachyServiceClient(ClientBaseConfiguration configuration) : base(conf
{
return CallInvoker.AsyncServerStreamingCall(__Method_StreamReachyState, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Reachy.ReachyStatus Audit(global::Reachy.ReachyId request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Audit(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Reachy.ReachyStatus Audit(global::Reachy.ReachyId request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Audit, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Reachy.ReachyStatus> AuditAsync(global::Reachy.ReachyId request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return AuditAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Reachy.ReachyStatus> AuditAsync(global::Reachy.ReachyId request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Audit, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncServerStreamingCall<global::Reachy.ReachyStatus> StreamAudit(global::Reachy.ReachyStreamAuditRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return StreamAudit(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncServerStreamingCall<global::Reachy.ReachyStatus> StreamAudit(global::Reachy.ReachyStreamAuditRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncServerStreamingCall(__Method_StreamAudit, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected override ReachyServiceClient NewInstance(ClientBaseConfiguration configuration)
Expand All @@ -203,7 +265,9 @@ protected override ReachyServiceClient NewInstance(ClientBaseConfiguration confi
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_GetReachy, serviceImpl.GetReachy)
.AddMethod(__Method_GetReachyState, serviceImpl.GetReachyState)
.AddMethod(__Method_StreamReachyState, serviceImpl.StreamReachyState).Build();
.AddMethod(__Method_StreamReachyState, serviceImpl.StreamReachyState)
.AddMethod(__Method_Audit, serviceImpl.Audit)
.AddMethod(__Method_StreamAudit, serviceImpl.StreamAudit).Build();
}

/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
Expand All @@ -216,6 +280,8 @@ public static void BindService(grpc::ServiceBinderBase serviceBinder, ReachyServ
serviceBinder.AddMethod(__Method_GetReachy, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Protobuf.WellKnownTypes.Empty, global::Reachy.Reachy>(serviceImpl.GetReachy));
serviceBinder.AddMethod(__Method_GetReachyState, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Reachy.ReachyId, global::Reachy.ReachyState>(serviceImpl.GetReachyState));
serviceBinder.AddMethod(__Method_StreamReachyState, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Reachy.ReachyStreamStateRequest, global::Reachy.ReachyState>(serviceImpl.StreamReachyState));
serviceBinder.AddMethod(__Method_Audit, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Reachy.ReachyId, global::Reachy.ReachyStatus>(serviceImpl.Audit));
serviceBinder.AddMethod(__Method_StreamAudit, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Reachy.ReachyStreamAuditRequest, global::Reachy.ReachyStatus>(serviceImpl.StreamAudit));
}

}
Expand Down
Loading

0 comments on commit fbd0786

Please sign in to comment.