-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding beacons to book keeping to subscribe from ROS 2 (#823)
* Adding beacons to book keeping to subscribe from ROS 2 Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Lint Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Cleaned up from_tortoise for linting Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Cast to proper bool type from ttm Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Disable pylint for import error as we are not using the same released API Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Disable block Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Disable just for the next issue instead of entire file Signed-off-by: Aaron Chong <aaronchongth@gmail.com> --------- Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
- Loading branch information
1 parent
7f4ef45
commit 56316c4
Showing
12 changed files
with
225 additions
and
6 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
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,27 @@ | ||
from typing import cast | ||
|
||
from . import tortoise_models as ttm | ||
from .ros_pydantic import rmf_fleet_msgs | ||
|
||
|
||
class BeaconState(rmf_fleet_msgs.BeaconState): | ||
@staticmethod | ||
def from_tortoise(tortoise: ttm.BeaconState) -> "BeaconState": | ||
return BeaconState( | ||
id=tortoise.id, | ||
online=cast(bool, tortoise.online), | ||
category=tortoise.category, | ||
activated=cast(bool, tortoise.activated), | ||
level=tortoise.level, | ||
) | ||
|
||
async def save(self) -> None: | ||
await ttm.BeaconState.update_or_create( | ||
{ | ||
"online": self.online, | ||
"category": self.category, | ||
"activated": self.activated, | ||
"level": self.level, | ||
}, | ||
id=self.id, | ||
) |
34 changes: 34 additions & 0 deletions
34
packages/api-server/api_server/models/ros_pydantic/rmf_fleet_msgs/BeaconState.py
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,34 @@ | ||
# This is a generated file, do not edit | ||
|
||
from typing import List | ||
|
||
import pydantic | ||
|
||
|
||
class BeaconState(pydantic.BaseModel): | ||
id: str = "" # string | ||
online: bool = False # bool | ||
category: str = "" # string | ||
activated: bool = False # bool | ||
level: str = "" # string | ||
|
||
class Config: | ||
orm_mode = True | ||
schema_extra = { | ||
"required": [ | ||
"id", | ||
"online", | ||
"category", | ||
"activated", | ||
"level", | ||
], | ||
} | ||
|
||
|
||
# # This message defines data from a robot beacon | ||
# | ||
# string id | ||
# bool online | ||
# string category | ||
# bool activated | ||
# string level |
43 changes: 43 additions & 0 deletions
43
packages/api-server/api_server/models/ros_pydantic/rmf_fleet_msgs/DeliveryAlert.py
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,43 @@ | ||
# This is a generated file, do not edit | ||
|
||
from typing import List | ||
|
||
import pydantic | ||
|
||
from ..rmf_fleet_msgs.DeliveryAlertAction import DeliveryAlertAction | ||
from ..rmf_fleet_msgs.DeliveryAlertCategory import DeliveryAlertCategory | ||
from ..rmf_fleet_msgs.DeliveryAlertTier import DeliveryAlertTier | ||
|
||
|
||
class DeliveryAlert(pydantic.BaseModel): | ||
id: str = "" # string | ||
category: DeliveryAlertCategory = ( | ||
DeliveryAlertCategory() | ||
) # rmf_fleet_msgs/DeliveryAlertCategory | ||
tier: DeliveryAlertTier = DeliveryAlertTier() # rmf_fleet_msgs/DeliveryAlertTier | ||
task_id: str = "" # string | ||
action: DeliveryAlertAction = ( | ||
DeliveryAlertAction() | ||
) # rmf_fleet_msgs/DeliveryAlertAction | ||
message: str = "" # string | ||
|
||
class Config: | ||
orm_mode = True | ||
schema_extra = { | ||
"required": [ | ||
"id", | ||
"category", | ||
"tier", | ||
"task_id", | ||
"action", | ||
"message", | ||
], | ||
} | ||
|
||
|
||
# string id | ||
# DeliveryAlertCategory category | ||
# DeliveryAlertTier tier | ||
# string task_id | ||
# DeliveryAlertAction action | ||
# string message |
24 changes: 24 additions & 0 deletions
24
packages/api-server/api_server/models/ros_pydantic/rmf_fleet_msgs/DeliveryAlertAction.py
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,24 @@ | ||
# This is a generated file, do not edit | ||
|
||
from typing import List | ||
|
||
import pydantic | ||
|
||
|
||
class DeliveryAlertAction(pydantic.BaseModel): | ||
value: pydantic.conint(ge=0, le=4294967295) = 0 # uint32 | ||
|
||
class Config: | ||
orm_mode = True | ||
schema_extra = { | ||
"required": [ | ||
"value", | ||
], | ||
} | ||
|
||
|
||
# uint32 value | ||
# uint32 WAITING=0 | ||
# uint32 CANCEL=1 | ||
# uint32 OVERRIDE=2 | ||
# uint32 RESUME=3 |
22 changes: 22 additions & 0 deletions
22
packages/api-server/api_server/models/ros_pydantic/rmf_fleet_msgs/DeliveryAlertCategory.py
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,22 @@ | ||
# This is a generated file, do not edit | ||
|
||
from typing import List | ||
|
||
import pydantic | ||
|
||
|
||
class DeliveryAlertCategory(pydantic.BaseModel): | ||
value: pydantic.conint(ge=0, le=4294967295) = 0 # uint32 | ||
|
||
class Config: | ||
orm_mode = True | ||
schema_extra = { | ||
"required": [ | ||
"value", | ||
], | ||
} | ||
|
||
|
||
# uint32 value | ||
# uint32 MISSING=0 | ||
# uint32 WRONG=1 |
22 changes: 22 additions & 0 deletions
22
packages/api-server/api_server/models/ros_pydantic/rmf_fleet_msgs/DeliveryAlertTier.py
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,22 @@ | ||
# This is a generated file, do not edit | ||
|
||
from typing import List | ||
|
||
import pydantic | ||
|
||
|
||
class DeliveryAlertTier(pydantic.BaseModel): | ||
value: pydantic.conint(ge=0, le=4294967295) = 0 # uint32 | ||
|
||
class Config: | ||
orm_mode = True | ||
schema_extra = { | ||
"required": [ | ||
"value", | ||
], | ||
} | ||
|
||
|
||
# uint32 value | ||
# uint32 WARNING=0 | ||
# uint32 ERROR=1 |
1 change: 1 addition & 0 deletions
1
packages/api-server/api_server/models/ros_pydantic/rmf_fleet_msgs/__init__.py
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