This repository was archived by the owner on Dec 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ void writeColor(Color color);
35
35
// High voltage is enabled when HIGH and disabled when LOW
36
36
int hv_enabled = LOW;
37
37
// True when a gait is being executed, false otherwise
38
- bool active = false ;
38
+ bool is_connected = false ;
39
39
40
40
ros::NodeHandle nh;
41
41
@@ -56,22 +56,19 @@ void setColorCallback(const std_msgs::ColorRGBA& color)
56
56
57
57
void errorCallback (const march_shared_resources::Error& /* error */ )
58
58
{
59
- active = false ;
60
59
writeColor (colors::ERROR);
61
60
}
62
61
63
62
void instructionResponseCallback (const march_shared_resources::GaitInstructionResponse& response)
64
63
{
65
64
if (response.result == response.GAIT_FINISHED )
66
65
{
67
- active = false ;
68
66
writeColor (colors::IDLE);
69
67
}
70
68
}
71
69
72
70
void currentGaitCallback (const std_msgs::String& /* gait */ )
73
71
{
74
- active = true ;
75
72
writeColor (colors::ACTIVE);
76
73
}
77
74
@@ -119,10 +116,12 @@ void loop()
119
116
120
117
if (!nh.connected ())
121
118
{
119
+ is_connected = false ;
122
120
writeColor (colors::OFF);
123
121
}
124
- else if (!active )
122
+ else if (!is_connected )
125
123
{
124
+ is_connected = true ;
126
125
writeColor (colors::IDLE);
127
126
}
128
127
nh.spinOnce ();
You can’t perform that action at this time.
0 commit comments