Skip to content

Commit

Permalink
Updated rmf_api to latest before adding decommission related schema
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
  • Loading branch information
aaronchongth committed Mar 22, 2024
1 parent aa96f48 commit 86248ed
Show file tree
Hide file tree
Showing 31 changed files with 313 additions and 274 deletions.
3 changes: 1 addition & 2 deletions packages/api-client/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
DispenserState,
DoorHealth,
DoorState,
ApiServerModelsRmfApiFleetStateFleetState,
FleetState,
IngestorHealth,
IngestorState,
LiftHealth,
Expand All @@ -19,7 +19,6 @@ import {
} from './openapi';

type Alert = ApiServerModelsTortoiseModelsAlertsAlertLeaf;
type FleetState = ApiServerModelsRmfApiFleetStateFleetState;

const debug = Debug('rmf-client');

Expand Down
230 changes: 109 additions & 121 deletions packages/api-client/lib/openapi/api.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/api-client/lib/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { version as rmfModelVer } from 'rmf-models';

export const version = {
rmfModels: rmfModelVer,
rmfServer: '6d36e1be8116a741a6e7206a90481171536e029c',
rmfServer: 'aa96f48b48cdc810a8e26c65bdc241fed828daf7',
openapiGenerator: '6.2.1',
};
152 changes: 74 additions & 78 deletions packages/api-client/schema/index.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/api-server/api_server/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .rmf_api.cancel_task_response import TaskCancelResponse
from .rmf_api.dispatch_task_request import DispatchTaskRequest
from .rmf_api.dispatch_task_response import *
from .rmf_api.fleet_log import FleetState as FleetLog
from .rmf_api.fleet_log import FleetLog as FleetLog
from .rmf_api.fleet_log_request import FleetLogRequest
from .rmf_api.fleet_log_response import FleetLogResponse
from .rmf_api.fleet_log_update import TaskEventLogUpdate as FleetLogUpdate
Expand All @@ -29,7 +29,7 @@
from .rmf_api.resume_task_response import TaskResumeResponse
from .rmf_api.rewind_task_request import TaskRewindRequest
from .rmf_api.rewind_task_response import TaskRewindResponse
from .rmf_api.robot_state import RobotState, Status2
from .rmf_api.robot_state import RobotState, Status
from .rmf_api.robot_task_request import RobotTaskRequest
from .rmf_api.robot_task_response import *
from .rmf_api.skip_phase_request import TaskPhaseSkipRequest
Expand Down
2 changes: 1 addition & 1 deletion packages/api-server/api_server/models/rmf_api/fleet_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from . import log_entry


class FleetState(BaseModel):
class FleetLog(BaseModel):
name: Optional[str] = None
log: Optional[List[log_entry.LogEntry]] = Field(
None, description="Log for the overall fleet"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Success(Enum):

class FleetLogResponseItem(BaseModel):
success: Success
data: fleet_log.FleetState
data: fleet_log.FleetLog


class FleetLogResponseItem1(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ class TaskEventLogUpdate(BaseModel):
type: Literal["fleet_log_update"] = Field(
..., description="Indicate that this is a fleet log update"
)
data: fleet_log.FleetState
data: fleet_log.FleetLog
4 changes: 2 additions & 2 deletions packages/api-server/api_server/models/rmf_api/robot_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from . import location_2D


class Status2(Enum):
class Status(Enum):
uninitialized = "uninitialized"
offline = "offline"
shutdown = "shutdown"
Expand All @@ -30,7 +30,7 @@ class Issue(BaseModel):

class RobotState(BaseModel):
name: Optional[str] = None
status: Optional[Status2] = Field(
status: Optional[Status] = Field(
None, description="A simple token representing the status of the robot"
)
task_id: Optional[str] = Field(
Expand Down
60 changes: 60 additions & 0 deletions packages/api-server/api_server/models/rmf_api/rtls_tag_state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# generated by datamodel-codegen:
# filename: rtls_tag_state.json

from __future__ import annotations

from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, Field, confloat

from . import location_2D


class Status2(Enum):
uninitialized = "uninitialized"
offline = "offline"
shutdown = "shutdown"
idle = "idle"
charging = "charging"
working = "working"
error = "error"


class LocationType(Enum):
zone = "zone"
coord = "coord"


class AssetType(BaseModel):
asset_type: Optional[str] = Field(None, description="type of the asset")
asset_subtype: Optional[str] = Field(None, description="subtype of the asset")


class Issue(BaseModel):
category: Optional[str] = Field(None, description="Category of the tag's issue")
detail: Optional[Union[Dict[str, Any], List, str]] = Field(
None, description="Detailed information about the issue"
)


class RtlsTagState(BaseModel):
tag_id: str = Field(..., description="The ID of the rtls tag.")
status: Optional[Status2] = Field(
None, description="A simple token representing the status of the tag"
)
location_type: Optional[LocationType] = Field(
None, description="The type location information provided by the tag."
)
asset_type: Optional[AssetType] = Field(
None, description="The type of the tagged asset."
)
unix_millis_time: Optional[int] = None
location: Optional[location_2D.Location2D] = None
battery: Optional[confloat(ge=0.0, le=1.0)] = Field(
None,
description="State of charge of the battery. Values range from 0.0 (depleted) to 1.0 (fully charged)",
)
issues: Optional[List[Issue]] = Field(
None, description="A list of issues with the tag that operators need to address"
)
4 changes: 4 additions & 0 deletions packages/api-server/api_server/models/rmf_api/task_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class TaskRequest(BaseModel):
None,
description="(Optional) An identifier for the entity that requested this task",
)
fleet_name: Optional[str] = Field(
None,
description="(Optional) The name of the fleet that should perform this task. If specified, other fleets will not bid for this task.",
)
unix_millis_warn_time: Optional[int] = Field(
None,
description="(Optional) The time at which a warning will be issued if the estimated completion time is later than expected",
Expand Down
15 changes: 15 additions & 0 deletions packages/api-server/api_server/models/rmf_api/transformation_2D.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# generated by datamodel-codegen:
# filename: transformation_2D.json

from __future__ import annotations

from pydantic import BaseModel


class Transformation2D(BaseModel):
target_map: str
ref_map: str
x: float
y: float
yaw: float
scale: float
2 changes: 1 addition & 1 deletion packages/api-server/api_server/models/rmf_api/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# THIS FILE IS GENERATED
version = {
"rmf_api_msgs": "91295892192d24ec73c9a1c6fa54334963586784",
"rmf_api_msgs": "a77c3a2d53f7f61aa379bf2ba64a41f98998c9f5",
"datamodel-code-generator": "0.11.19",
}
2 changes: 1 addition & 1 deletion packages/api-server/generate-models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ shopt -s globstar

RMF_BUILDING_MAP_MSGS_VER=c5e0352e2dfd3d11e4d292a1c2901cad867c1441
RMF_INTERNAL_MSGS_VER=3690a47055ef45466cf970587d8b8e09df1a8825
RMF_API_MSGS_VER=91295892192d24ec73c9a1c6fa54334963586784
RMF_API_MSGS_VER=a77c3a2d53f7f61aa379bf2ba64a41f98998c9f5
RMF_ROS2_VER=bf038461b5b0fb7d4594461a724bc9e5e7cb97c6
CODEGEN_VER=$(pipenv run datamodel-codegen --version)

Expand Down
4 changes: 1 addition & 3 deletions packages/dashboard/src/components/map-app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, styled, Typography, useMediaQuery } from '@mui/material';
import { BuildingMap, ApiServerModelsRmfApiFleetStateFleetState, Level, Lift } from 'api-client';
import { BuildingMap, FleetState, Level, Lift } from 'api-client';
import { Door as DoorModel } from 'rmf-models';
import Debug from 'debug';
import React, { ChangeEvent, Suspense } from 'react';
Expand Down Expand Up @@ -31,8 +31,6 @@ import { Lifts, Door, RobotThree } from './three-fiber';
import { DoorSummary } from './door-summary';
import { LiftSummary } from './lift-summary';

type FleetState = ApiServerModelsRmfApiFleetStateFleetState;

const debug = Debug('MapApp');

const TrajectoryUpdateInterval = 2000;
Expand Down
3 changes: 1 addition & 2 deletions packages/dashboard/src/components/rmf-app/rmf-ingress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
DoorsApi,
DoorState,
FleetsApi,
ApiServerModelsRmfApiFleetStateFleetState,
FleetState,
Ingestor,
IngestorsApi,
IngestorState,
Expand All @@ -40,7 +40,6 @@ import {
} from '../../managers/robot-trajectory-manager';

type Alert = ApiServerModelsTortoiseModelsAlertsAlertLeaf;
type FleetState = ApiServerModelsRmfApiFleetStateFleetState;

export class RmfIngress {
// This should be private because socketio does not support "replaying" subscription. If
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, ButtonProps, Theme, Tooltip, Typography } from '@mui/material';
import { AppEvents } from '../app-events';
import { RobotState, Status2 } from 'api-client';
import { RobotState, ApiServerModelsRmfApiRobotStateStatus as Status } from 'api-client';
import React from 'react';
import { AppControllerContext } from '../app-contexts';
import { RmfAppContext } from '../rmf-app';
Expand Down Expand Up @@ -41,7 +41,7 @@ export function RobotDecommissionButton({
);

const robotDecommissioned =
robotState && robotState.status && robotState.status === Status2.Uninitialized;
robotState && robotState.status && robotState.status === Status.Uninitialized;
// TODO: use authz for decommissioning robot
// const profile: UserProfile | null = React.useContext(UserProfileContext);
// const userCanDecommissionRobot = profile && Enforcer.canDecommissionRobot(profile);
Expand Down
10 changes: 5 additions & 5 deletions packages/dashboard/src/components/robots/robot-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { makeStyles, createStyles } from '@mui/styles';
import React from 'react';
import { RmfAppContext } from '../rmf-app';
import { RobotTableData, base } from 'react-components';
import { RobotState, Status2, TaskState } from 'api-client';
import { RobotState, ApiServerModelsRmfApiRobotStateStatus as Status, TaskState } from 'api-client';
import { EMPTY, combineLatest, mergeMap, of } from 'rxjs';
import { TaskInspector } from '../tasks/task-inspector';
import {
Expand Down Expand Up @@ -46,16 +46,16 @@ const useStyles = makeStyles((theme: Theme) =>
}),
);

const setTaskDialogColor = (robotStatus: Status2 | undefined) => {
const setTaskDialogColor = (robotStatus: Status | undefined) => {
if (!robotStatus) {
return base.palette.background.default;
}

switch (robotStatus) {
case Status2.Error:
case Status.Error:
return base.palette.error.dark;

case Status2.Working:
case Status.Working:
return base.palette.success.dark;

default:
Expand Down Expand Up @@ -84,7 +84,7 @@ interface RobotSummaryProps {
}

const showBatteryIcon = (robot: RobotState, robotBattery: number) => {
if (robot.status === Status2.Charging) {
if (robot.status === Status.Charging) {
return <BatteryChargingFull />;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/components/tasks/task-alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ApiServerModelsRmfApiLogEntryTier as Tier,
ApiServerModelsTortoiseModelsAlertsAlertLeaf,
LogEntry,
Status,
ApiServerModelsRmfApiTaskStateStatus as Status,
Status1,
TaskEventLog,
TaskState,
Expand Down
7 changes: 6 additions & 1 deletion packages/dashboard/src/components/tasks/task-logs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Box, Divider, Grid, Paper, Typography, useTheme } from '@mui/material';
import { EventState, Status, TaskEventLog, TaskState } from 'api-client';
import {
EventState,
ApiServerModelsRmfApiTaskStateStatus as Status,
TaskEventLog,
TaskState,
} from 'api-client';
import { format } from 'date-fns';

interface TaskLogProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/components/tasks/task-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
import { makeStyles, createStyles } from '@mui/styles';
import { Status, TaskRequest, TaskState } from 'api-client';
import { ApiServerModelsRmfApiTaskStateStatus as Status, TaskRequest, TaskState } from 'api-client';
import { base, parseCartId, parseCategory, parseDestination, parsePickup } from 'react-components';
import { TaskInspector } from './task-inspector';
import { RmfAppContext } from '../rmf-app';
Expand Down
10 changes: 1 addition & 9 deletions packages/dashboard/src/util/common-subscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import React from 'react';
import * as RmfModels from 'rmf-models';
import {
ApiServerModelsRmfApiFleetStateFleetState,
SioClient,
Ingestor,
Dispenser,
Subscription,
} from 'api-client';
import { FleetState, SioClient, Ingestor, Dispenser, Subscription } from 'api-client';
import { RmfIngress } from '../components/rmf-app/rmf-ingress';

type FleetState = ApiServerModelsRmfApiFleetStateFleetState;

export const useFleets = (
rmfIngress: RmfIngress | undefined,
setFleets: React.Dispatch<React.SetStateAction<FleetState[]>>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, fireEvent } from '@testing-library/react';
import { Status2 as RobotStatus } from 'api-client';
import { ApiServerModelsRmfApiRobotStateStatus as RobotStatus } from 'api-client';
import React from 'react';
import { RobotTableData } from './robot-table';
import { makeRobot } from './test-utils.spec';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { RobotDataGridTable } from './robot-table-datagrid';
import { Status2 as RobotStatus } from 'api-client';
import { ApiServerModelsRmfApiRobotStateStatus as RobotStatus } from 'api-client';
import { RobotTableData } from './robot-table';

// Define the stories
Expand Down
19 changes: 9 additions & 10 deletions packages/react-components/lib/robots/robot-table-datagrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
} from '@mui/x-data-grid';
import { Box, SxProps, Typography, useTheme, useMediaQuery } from '@mui/material';
import * as React from 'react';
import { Status2 } from 'api-client';
import { ApiServerModelsRmfApiRobotStateStatus as Status } from 'api-client';
import { RobotTableData } from './robot-table';
import { robotStatusToUpperCase } from './utils';

export interface RobotDataGridTableProps {
onRobotClick?(ev: MuiEvent<React.MouseEvent<HTMLElement>>, robotName: RobotTableData): void;
Expand All @@ -30,7 +29,7 @@ export function RobotDataGridTable({ onRobotClick, robots }: RobotDataGridTableP
}
};

const Status = (params: GridCellParams): React.ReactNode => {
const StatusCell = (params: GridCellParams): React.ReactNode => {
const theme = useTheme();
const statusLabelStyle: SxProps = (() => {
const error = {
Expand All @@ -50,14 +49,14 @@ export function RobotDataGridTable({ onRobotClick, robots }: RobotDataGridTableP
};

switch (params.row.status) {
case Status2.Error:
case Status.Error:
return error;
case Status2.Offline:
case Status2.Uninitialized:
case Status.Offline:
case Status.Uninitialized:
return disabled;
case Status2.Charging:
case Status.Charging:
return charging;
case Status2.Working:
case Status.Working:
return working;
default:
return defaultColor;
Expand All @@ -74,7 +73,7 @@ export function RobotDataGridTable({ onRobotClick, robots }: RobotDataGridTableP
fontSize: isScreenHeightLessThan800 ? 10 : 16,
}}
>
{robotStatusToUpperCase(params.row.status)}
{params.row.status.toUpperCase()}
</Typography>
</Box>
);
Expand Down Expand Up @@ -141,7 +140,7 @@ export function RobotDataGridTable({ onRobotClick, robots }: RobotDataGridTableP
headerName: 'Status',
editable: false,
flex: 1,
renderCell: Status,
renderCell: StatusCell,
filterable: true,
},
];
Expand Down
Loading

0 comments on commit 86248ed

Please sign in to comment.