forked from ros2-dotnet/ros2_dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions: extend idl generation to include interfaces for "action wrap…
…per types" With "action wrapper types" this means the ROS messages and services that add the `GoalId`, `TimeStamp` or other fields on top of the user defined types for the action. The introduced methods in `IRosActionDefinition` are needed to work around the missing existential type support in C# (dotnet/csharplang#5556).
- Loading branch information
1 parent
adebb26
commit 2aa60ce
Showing
12 changed files
with
288 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Copyright 2022 Stefan Hoffmann <stefan.hoffmann@schiller.de> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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. | ||
*/ | ||
|
||
namespace ROS2 | ||
{ | ||
public interface IRosActionFeedbackMessage<TFeedback> : IRosMessage | ||
where TFeedback : IRosMessage, new() | ||
{ | ||
// NOTICE: cyclic reference, see `IRosActionSendGoalRequest<TGoal>` | ||
// unique_identifier_msgs.msg.UUID GoalId { get; set; } | ||
|
||
TFeedback Feedback { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Copyright 2022 Stefan Hoffmann <stefan.hoffmann@schiller.de> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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. | ||
*/ | ||
|
||
namespace ROS2 | ||
{ | ||
public interface IRosActionGetResultRequest : IRosMessage | ||
{ | ||
// NOTICE: cyclic reference, see `IRosActionSendGoalRequest<TGoal>` | ||
// unique_identifier_msgs.msg.UUID GoalId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* Copyright 2022 Stefan Hoffmann <stefan.hoffmann@schiller.de> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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. | ||
*/ | ||
|
||
namespace ROS2 | ||
{ | ||
public interface IRosActionGetResultResponse<TResult> : IRosMessage | ||
where TResult : IRosMessage, new() | ||
{ | ||
sbyte Status { get; set; } | ||
|
||
TResult Result { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* Copyright 2022 Stefan Hoffmann <stefan.hoffmann@schiller.de> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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. | ||
*/ | ||
|
||
namespace ROS2 | ||
{ | ||
public interface IRosActionSendGoalRequest<TGoal> : IRosMessage | ||
where TGoal : IRosMessage, new() | ||
{ | ||
// NOTICE: This would cause a cyclic reference: | ||
// | ||
// - `unique_identifier_msgs.msg.UUID` in the `unique_identifier_msgs` | ||
// assembly references `IRosMessage` in the `rcldotnet_common` | ||
// assembly. | ||
// - `IRosActionSendGoalRequest<TGoal>` in the `rcldotnet_common` | ||
// assembly references `unique_identifier_msgs.msg.UUID` in the | ||
// `unique_identifier_msgs` assembly. | ||
// | ||
// So we need a workaround: | ||
// - Use reflection later on to get to this. | ||
// - Or use types like `byte[]` (or ValueTuple<int, int> for | ||
// `builtin_interfaces.msg.Time`) and generate accessor methods that | ||
// convert and use those types. | ||
// - Or provide property `IRosMessage GoalIdRosMessage { get; set; }` | ||
// and cast to the concrete type on usage. | ||
// | ||
// unique_identifier_msgs.msg.UUID GoalId { get; set; } | ||
|
||
TGoal Goal { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* Copyright 2022 Stefan Hoffmann <stefan.hoffmann@schiller.de> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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. | ||
*/ | ||
|
||
namespace ROS2 | ||
{ | ||
public interface IRosActionSendGoalResponse : IRosMessage | ||
{ | ||
bool Accepted { get; set; } | ||
|
||
// NOTICE: cyclic reference, see `IRosActionSendGoalRequest<TGoal>` | ||
// builtin_interfaces.msg.Time Stamp { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.