Skip to content

Commit 0437788

Browse files
committed
Add a power_cycle test to dashboard_client_g5
1 parent 2f2c82d commit 0437788

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/test_dashboard_client_g5.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,43 @@ TEST_F(DashboardClientTestG5, connect)
9191
ASSERT_TRUE(response.ok);
9292
}
9393

94+
TEST_F(DashboardClientTestG5, power_cycle)
95+
{
96+
EXPECT_TRUE(dashboard_client_->connect());
97+
DashboardResponse response;
98+
99+
// Cycle from POWER_OFF to IDLE to RUNNING
100+
response = dashboard_client_->commandPowerOff();
101+
EXPECT_TRUE(response.ok);
102+
response = dashboard_client_->commandPowerOn(std::chrono::seconds(5));
103+
EXPECT_TRUE(response.ok);
104+
response = dashboard_client_->commandBrakeRelease();
105+
EXPECT_TRUE(response.ok);
106+
107+
// Calling power_on on a brake-released robot should succeed
108+
response = dashboard_client_->commandPowerOn(std::chrono::seconds(5));
109+
EXPECT_TRUE(response.ok);
110+
111+
// Power off from brake-released state (RUNNING)
112+
response = dashboard_client_->commandPowerOff();
113+
EXPECT_TRUE(response.ok);
114+
115+
// Power off from powered_on state (IDLE)
116+
dashboard_client_->commandPowerOn();
117+
response = dashboard_client_->commandPowerOff();
118+
EXPECT_TRUE(response.ok);
119+
120+
// Power off from powered_on state (IDLE)
121+
dashboard_client_->commandPowerOff();
122+
response = dashboard_client_->commandPowerOff();
123+
EXPECT_TRUE(response.ok);
124+
125+
// Brake release from POWER_OFF should succeed
126+
dashboard_client_->commandPowerOff();
127+
response = dashboard_client_->commandBrakeRelease();
128+
EXPECT_TRUE(response.ok);
129+
}
130+
94131
TEST_F(DashboardClientTestG5, run_program)
95132
{
96133
EXPECT_TRUE(dashboard_client_->connect());

0 commit comments

Comments
 (0)