Skip to content
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
24 changes: 24 additions & 0 deletions src/pages/operator/css/FooterGlobal.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,30 @@
transition: filter 200ms ease-out;
}

/* Pulse animation for running state */
@keyframes run-stop-pulse {
0% {
filter: brightness(1);
opacity: 1;
}
25% {
filter: brightness(1.5);
opacity: 0.7;
}
75% {
filter: brightness(2);
opacity: 0.4;
}
100% {
filter: brightness(1);
opacity: 1;
}
}

.footer-global .run-stop-container .run-stop-button.stopped .icon {
animation: run-stop-pulse 1.5s ease-in-out infinite;
}

/* END RunStop Button */

/* START Scene Menu Button */
Expand Down
23 changes: 0 additions & 23 deletions src/pages/operator/css/RunStopButton.css

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/operator/tsx/MobileOperator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const MobileOperator = (props: {
const [isCameraVeilVisible, isCameraVeilVisibleSet] = useState(false);

// Track homed state in local React state
const [robotIsHomed, robotIsHomedSet] = useState<boolean>(false);
const [robotIsHomed, robotIsHomedSet] = useState<boolean>(true);
// True once `HomingBanner` has fully dismissed (after success strip + exit), not merely `robotIsHomed`
const [homingBannerDismissed, homingBannerDismissedSet] =
useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type RunStopFunctions = {
};

export class RunStopFunctionProvider extends FunctionProvider {
private enabled: boolean;
private enabled: boolean = false;
private runStopStateChangeCallback: (enabled: boolean) => void;

constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { RemoteStream, StretchTool } from "shared/util";
import { ButtonPad } from "./ButtonPad";
import { ButtonStateMap } from "../function_providers/ButtonFunctionProvider";
import { Map } from "./Map";
import { RunStopButton } from "../static_components/RunStop";
import { BatteryGauge } from "../static_components/BatteryGauge";
import { MovementRecorder } from "./MovementRecorder";

Expand Down Expand Up @@ -77,8 +76,6 @@ export const CustomizableComponent = (props: CustomizableComponentProps) => {
return <ButtonPad {...props} />;
case ComponentType.Map:
return <Map {...props} />;
case ComponentType.RunStopButton:
return <RunStopButton {...props} />;
case ComponentType.BatteryGauge:
return <BatteryGauge {...props} />;
case ComponentType.MovementRecorder:
Expand Down
15 changes: 10 additions & 5 deletions src/pages/operator/tsx/layout_components/FooterGlobal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import batteryIcon from "operator/icons/Battery_Footer.svg";
import runStopRunIcon from "operator/icons/RunStop_Run.svg";
import runStopStopIcon from "operator/icons/RunStop_Stop.svg";
import "operator/css/FooterGlobal.css";
import { runStopFunctionProvider } from "..";
import { RunStopFunctions } from "../function_providers/RunStopFunctionProvider";

interface FooterGlobalProps {
swipeableViewsIdxSet: React.Dispatch<React.SetStateAction<number>>;
Expand All @@ -23,9 +25,12 @@ const FooterGlobal: React.FC<FooterGlobalProps> = ({
sceneSelected,
onSceneSelectedChange,
}) => {
const [isStopped, isStoppedSet] = useState<boolean>(false);
const [isRunStopped, isRunStoppedSet] = useState<boolean>(false);
const [isMainMenuOpen, isMainMenuOpenSet] = useState<boolean>(false);

runStopFunctionProvider.setRunStopStateChangeCallback(isRunStoppedSet);
const functs: RunStopFunctions = runStopFunctionProvider.provideFunctions();

const scenes: SceneItem[] = useMemo(
() => [
{
Expand Down Expand Up @@ -124,13 +129,13 @@ const FooterGlobal: React.FC<FooterGlobalProps> = ({
</div>
<div className="run-stop-container">
<button
onClick={() => isStoppedSet(!isStopped)}
onClick={() => functs.onClick()}
type="button"
className={`run-stop-button ${isStopped ? "stopped" : "running"}`}
aria-label={isStopped ? "Run" : "Stop"}
className={`run-stop-button ${isRunStopped ? "stopped" : "running"}`}
aria-label={isRunStopped ? "Run" : "Stop"}
>
<img
src={!isStopped ? runStopStopIcon : runStopRunIcon}
src={!isRunStopped ? runStopStopIcon : runStopRunIcon}
alt=""
aria-hidden="true"
className="icon"
Expand Down
33 changes: 0 additions & 33 deletions src/pages/operator/tsx/static_components/RunStop.tsx

This file was deleted.

44 changes: 20 additions & 24 deletions src/pages/robot/tsx/robot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
ROSBatteryState,
StretchTool,
getStretchTool,
DiagnosticArray,
} from "shared/util";
import {
rosJointStatetoRobotPose,
Expand Down Expand Up @@ -254,8 +255,7 @@ export class Robot extends React.Component {
this.subscribeToJointLimits();
this.subscribeToBatteryState();
this.subscribeToMode();
this.subscribeToIsHomed();
this.subscribeToIsRunStopped();
this.subscribetoJointStateDiagnostics();
this.subscribeToActionResult(
moveBaseActionName,
this.moveBaseResultCallback,
Expand Down Expand Up @@ -368,29 +368,25 @@ export class Robot extends React.Component {
});
}

subscribeToIsHomed() {
const isHomedTopic: Topic = new Topic({
subscribetoJointStateDiagnostics() {
const jointStateDiagnosticsTopic: Topic = new Topic({
ros: this.ros,
name: "/is_homed",
messageType: "std_msgs/msg/Bool",
name: "/joint_states_diagnostics",
messageType: "diagnostic_msgs/msg/DiagnosticArray",
});
this.subscriptions.push(isHomedTopic);

isHomedTopic.subscribe((msg) => {
if (this.isHomedCallback) this.isHomedCallback(msg.data);
});
}

subscribeToIsRunStopped() {
let topic: Topic = new Topic({
ros: this.ros,
name: "is_runstopped",
messageType: "std_msgs/msg/Bool",
});
this.subscriptions.push(topic);

topic.subscribe((msg) => {
if (this.isRunStoppedCallback) this.isRunStoppedCallback(msg.data);
this.subscriptions.push(jointStateDiagnosticsTopic);
jointStateDiagnosticsTopic.subscribe((message: Message) => {
let msg = message as DiagnosticArray;
msg.status.forEach((status) => {
if (status.name == "is_runstopped") {
let isRunStopped = status.values.every((v) => v.value == 'True');
if (this.isRunStoppedCallback) this.isRunStoppedCallback(isRunStopped);
}
if (status.name == "is_homed") {
let isHomed = status.values.every((v) => v.value == 'True');
if (this.isHomedCallback) this.isHomedCallback(isHomed);
}
});
});
}

Expand Down Expand Up @@ -606,7 +602,7 @@ export class Robot extends React.Component {
createRunStopService() {
this.setRunStopService = new Service({
ros: this.ros,
name: "/runstop",
name: "/runstop_the_robot",
serviceType: "std_srvs/srv/SetBool",
});
}
Expand Down
20 changes: 16 additions & 4 deletions src/shared/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export type RemoteStream = {
track: MediaStreamTrack;
};



export type ValidJointStateDict = { [key in ValidJoints]?: [boolean, boolean] };

export interface ROSJointState extends Message {
Expand All @@ -38,6 +36,22 @@ export interface ROSJointState extends Message {
velocity: [number];
}

export interface DiagnosticArray extends Message {
status: DiagnosticStatus[];
}

export interface DiagnosticStatus extends Message {
name: string;
level: number;
message: string;
hardware_id: string;
values: KeyValue[];
}

export interface KeyValue {
key: string;
value: string;
}
export enum StretchTool {
DW4 = "eoa_wrist_dw4_tool_sg4",
TABLET = "eoa_wrist_dw3_tool_tablet",
Expand Down Expand Up @@ -165,8 +179,6 @@ export interface BatteryVoltageMessage {
message: number;
}



export interface ROSPoint extends Message {
x: number;
y: number;
Expand Down
Loading