Commit 0b74418c authored by beuchatp's avatar beuchatp
Browse files

Changed header field from shouldCheckForID to shouldCheckForAgentID

parent 112cd7de
......@@ -1110,7 +1110,7 @@ void MainGUIWindow::on_all_motors_off_button_clicked()
{
dfall_pkg::IntWithHeader msg;
msg.data = CMD_CRAZYFLY_MOTORS_OFF;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
//commandAllAgentsPublisher.publish(msg);
emergencyStopPublisher.publish(msg);
}
......
......@@ -709,7 +709,7 @@ void ConnectStartStopBar::fillIntMessageHeader( dfall_pkg::IntWithHeader & msg )
{
case TYPE_AGENT:
{
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
break;
}
case TYPE_COORDINATOR:
......@@ -717,7 +717,7 @@ void ConnectStartStopBar::fillIntMessageHeader( dfall_pkg::IntWithHeader & msg )
// Lock the mutex
m_agentIDs_toCoordinate_mutex.lock();
// Add the "coordinate all" flag
msg.shouldCheckForID = !(m_shouldCoordinateAll);
msg.shouldCheckForAgentID = !(m_shouldCoordinateAll);
// Add the agent IDs if necessary
if (!m_shouldCoordinateAll)
{
......@@ -733,7 +733,7 @@ void ConnectStartStopBar::fillIntMessageHeader( dfall_pkg::IntWithHeader & msg )
default:
{
msg.shouldCheckForID = true;
msg.shouldCheckForAgentID = true;
ROS_ERROR("[ENABLE CONTROLLER LOAD YAML GUI BAR] The 'm_type' variable was not recognised.");
break;
}
......
......@@ -762,7 +762,7 @@ void CoordinatorRow::on_rf_connect_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
msg.data = CMD_RECONNECT;
this->crazyRadioCommandPublisher.publish(msg);
ROS_INFO_STREAM("[COORDINATOR ROW agentID:" << m_agentID << " GUI] Connect button clicked");
......@@ -773,7 +773,7 @@ void CoordinatorRow::on_rf_disconnect_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
msg.data = CMD_DISCONNECT;
this->crazyRadioCommandPublisher.publish(msg);
ROS_INFO_STREAM("[COORDINATOR ROW agentID:" << m_agentID << " GUI] Disconnect button clicked");
......@@ -784,7 +784,7 @@ void CoordinatorRow::on_enable_flying_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
msg.data = CMD_CRAZYFLY_TAKE_OFF;
this->flyingStateCommandPublisher.publish(msg);
ROS_INFO_STREAM("[COORDINATOR ROW agentID:" << m_agentID << " GUI] Enable flying button clicked");
......@@ -795,7 +795,7 @@ void CoordinatorRow::on_disable_flying_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
msg.data = CMD_CRAZYFLY_LAND;
this->flyingStateCommandPublisher.publish(msg);
ROS_INFO_STREAM("[COORDINATOR ROW agentID:" << m_agentID << " GUI] Disable flying button clicked");
......@@ -806,7 +806,7 @@ void CoordinatorRow::on_motors_off_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
msg.data = CMD_CRAZYFLY_MOTORS_OFF;
this->flyingStateCommandPublisher.publish(msg);
ROS_INFO_STREAM("[COORDINATOR ROW agentID:" << m_agentID << " GUI] Motors-off button clicked");
......
......@@ -269,7 +269,7 @@ void EnableControllerLoadYamlBar::fillIntMessageHeader( dfall_pkg::IntWithHeader
{
case TYPE_AGENT:
{
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
break;
}
case TYPE_COORDINATOR:
......@@ -277,7 +277,7 @@ void EnableControllerLoadYamlBar::fillIntMessageHeader( dfall_pkg::IntWithHeader
// Lock the mutex
m_agentIDs_toCoordinate_mutex.lock();
// Add the "coordinate all" flag
msg.shouldCheckForID = !(m_shouldCoordinateAll);
msg.shouldCheckForAgentID = !(m_shouldCoordinateAll);
// Add the agent IDs if necessary
if (!m_shouldCoordinateAll)
{
......@@ -293,7 +293,7 @@ void EnableControllerLoadYamlBar::fillIntMessageHeader( dfall_pkg::IntWithHeader
default:
{
msg.shouldCheckForID = true;
msg.shouldCheckForAgentID = true;
ROS_ERROR("[ENABLE CONTROLLER LOAD YAML GUI BAR] The 'm_type' variable was not recognised.");
break;
}
......@@ -313,7 +313,7 @@ void EnableControllerLoadYamlBar::fillStringMessageHeader( dfall_pkg::StringWith
{
case TYPE_AGENT:
{
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
break;
}
case TYPE_COORDINATOR:
......@@ -321,7 +321,7 @@ void EnableControllerLoadYamlBar::fillStringMessageHeader( dfall_pkg::StringWith
// Lock the mutex
m_agentIDs_toCoordinate_mutex.lock();
// Add the "coordinate all" flag
msg.shouldCheckForID = !(m_shouldCoordinateAll);
msg.shouldCheckForAgentID = !(m_shouldCoordinateAll);
// Add the agent IDs if necessary
if (!m_shouldCoordinateAll)
{
......@@ -337,7 +337,7 @@ void EnableControllerLoadYamlBar::fillStringMessageHeader( dfall_pkg::StringWith
default:
{
msg.shouldCheckForID = true;
msg.shouldCheckForAgentID = true;
ROS_ERROR("[ENABLE CONTROLLER LOAD YAML GUI BAR] The 'm_type' variable was not recognised.");
break;
}
......
......@@ -185,7 +185,7 @@ void MainWindow::on_action_LoadYAML_BatteryMonitor_triggered()
// Specify the data
yaml_filename_msg.data = "BatteryMonitor";
// Set for whom this applies to
yaml_filename_msg.shouldCheckForID = false;
yaml_filename_msg.shouldCheckForAgentID = false;
// Send the message
m_requestLoadYamlFilenamePublisher.publish(yaml_filename_msg);
#endif
......@@ -203,7 +203,7 @@ void MainWindow::on_action_LoadYAML_ClientConfig_triggered()
// Specify the data
yaml_filename_msg.data = "ClientConfig";
// Set for whom this applies to
yaml_filename_msg.shouldCheckForID = false;
yaml_filename_msg.shouldCheckForAgentID = false;
// Send the message
m_requestLoadYamlFilenamePublisher.publish(yaml_filename_msg);
#endif
......
......@@ -262,7 +262,7 @@ void TopBanner::on_emergency_stop_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
msg.data = CMD_CRAZYFLY_MOTORS_OFF;
this->emergencyStopPublisher.publish(msg);
ROS_INFO("[TOP BANNER GUI] EMERGENCY STOP button clicked");
......
......@@ -537,7 +537,7 @@ void TuningControllerTab::fillFloatMessageHeader( dfall_pkg::FloatWithHeader & m
{
case TYPE_AGENT:
{
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
break;
}
case TYPE_COORDINATOR:
......@@ -545,7 +545,7 @@ void TuningControllerTab::fillFloatMessageHeader( dfall_pkg::FloatWithHeader & m
// Lock the mutex
m_agentIDs_toCoordinate_mutex.lock();
// Add the "coordinate all" flag
msg.shouldCheckForID = !(m_shouldCoordinateAll);
msg.shouldCheckForAgentID = !(m_shouldCoordinateAll);
// Add the agent IDs if necessary
if (!m_shouldCoordinateAll)
{
......@@ -561,7 +561,7 @@ void TuningControllerTab::fillFloatMessageHeader( dfall_pkg::FloatWithHeader & m
default:
{
msg.shouldCheckForID = true;
msg.shouldCheckForAgentID = true;
ROS_ERROR("[TUNING CONTROLLER TAB GUI] The 'm_type' variable was not recognised.");
break;
}
......
......@@ -170,7 +170,7 @@ class CrazyRadioClient:
self._send_to_commander_motor(0, 0, 0, 0)
# change state to motors OFF
msg = IntWithHeader()
msg.shouldCheckForID = False
msg.shouldCheckForAgentID = False
msg.data = CMD_CRAZYFLY_MOTORS_OFF
self.FlyingAgentClient_command_pub.publish(msg)
time.sleep(0.1)
......@@ -230,7 +230,7 @@ class CrazyRadioClient:
self.change_status_to(CONNECTED)
# change state to motors OFF
msg = IntWithHeader()
msg.shouldCheckForID = False
msg.shouldCheckForAgentID = False
msg.data = CMD_CRAZYFLY_MOTORS_OFF
cf_client.FlyingAgentClient_command_pub.publish(msg)
......@@ -260,7 +260,7 @@ class CrazyRadioClient:
# change state to motors OFF
msg = IntWithHeader()
msg.shouldCheckForID = False
msg.shouldCheckForAgentID = False
msg.data = CMD_CRAZYFLY_MOTORS_OFF
self.FlyingAgentClient_command_pub.publish(msg)
......@@ -300,7 +300,7 @@ class CrazyRadioClient:
command_is_relevant = False
# Check the header details of the message for it relevance
if (msg.shouldCheckForID == False):
if (msg.shouldCheckForAgentID == False):
command_is_relevant = True
else:
for this_ID in msg.agentIDs:
......@@ -435,7 +435,7 @@ if __name__ == '__main__':
cf_client._send_to_commander_motor(0, 0, 0, 0)
# change state to motors OFF
msg = IntWithHeader()
msg.shouldCheckForID = False
msg.shouldCheckForAgentID = False
msg.data = CMD_CRAZYFLY_MOTORS_OFF
cf_client.FlyingAgentClient_command_pub.publish(msg)
#wait for client to send its commands
......
......@@ -129,4 +129,4 @@ void constructNamespaceForCoordinator( int coordID, std::string & coord_namespac
void constructNamespaceForCoordinatorParameterService( int coordID, std::string & coord_param_service_namespace );
// Check the header of a message for whether it is relevant
bool checkMessageHeader( int agentID , bool shouldCheckForID , const std::vector<uint> & agentIDs );
\ No newline at end of file
bool checkMessageHeader( int agentID , bool shouldCheckForAgentID , const std::vector<uint> & agentIDs );
\ No newline at end of file
float32 data
bool shouldCheckForID
bool shouldCheckForAgentID
uint32[] agentIDs
\ No newline at end of file
uint32 data
bool shouldCheckForID
bool shouldCheckForAgentID
uint32[] agentIDs
\ No newline at end of file
string data
bool shouldCheckForID
bool shouldCheckForAgentID
uint32[] agentIDs
\ No newline at end of file
......@@ -209,11 +209,11 @@ void constructNamespaceForCoordinatorParameterService( int coordID, std::string
// Check the header of a message for whether it is relevant
bool checkMessageHeader( int agentID , bool shouldCheckForID , const std::vector<uint> & agentIDs )
bool checkMessageHeader( int agentID , bool shouldCheckForAgentID , const std::vector<uint> & agentIDs )
{
// The messag is by default relevant if the "shouldCheckForID"
// The messag is by default relevant if the "shouldCheckForAgentID"
// flag is false
if (!shouldCheckForID)
if (!shouldCheckForAgentID)
{
return true;
}
......
......@@ -310,7 +310,7 @@ void updateBatteryStateBasedOnLevel(int level)
void isReadyBatteryMonitorYamlCallback(const IntWithHeader & msg)
{
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......
......@@ -675,7 +675,7 @@ void customCommandReceivedCallback(const CustomButtonWithHeader& commandReceived
void isReadyDefaultControllerYamlCallback(const IntWithHeader & msg)
{
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......@@ -895,7 +895,7 @@ int main(int argc, char* argv[])
// Specify the Yaml filename as a string
loadYamlFromFilenameCall.request.stringWithHeader.data = "DefaultController";
// Set for whom this applies to
loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForID = false;
loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForAgentID = false;
// Wait until the serivce exists
requestLoadYamlFilenameServiceClient.waitForExistence(ros::Duration(-1));
// Make the service call
......
......@@ -1456,7 +1456,7 @@ void publish_current_xyz_yaw(float x, float y, float z, float yaw)
void isReadyDemoControllerYamlCallback(const IntWithHeader & msg)
{
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......@@ -1849,7 +1849,7 @@ int main(int argc, char* argv[]) {
// Specify the data
yaml_filename_msg.data = "DemoController";
// Set for whom this applies to
yaml_filename_msg.shouldCheckForID = false;
yaml_filename_msg.shouldCheckForAgentID = false;
// Sleep to make the publisher known to ROS (in seconds)
//ros::Duration(1.0).sleep();
// Send the message
......
......@@ -417,7 +417,7 @@ void loadCrazyflieContext() {
ROS_INFO("[FLYING AGENT CLIENT] CF is now different for this student. Disconnect and turn it off");
IntWithHeader msg;
msg.shouldCheckForID = false;
msg.shouldCheckForAgentID = false;
msg.data = CMD_DISCONNECT;
crazyRadioCommandPublisher.publish(msg);
}
......@@ -438,7 +438,7 @@ void loadCrazyflieContext() {
void commandCallback(const IntWithHeader & msg) {
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......@@ -962,7 +962,7 @@ bool getCurrentFlyingStateServiceCallback(IntIntService::Request &request, IntIn
void isReadySafeControllerYamlCallback(const IntWithHeader & msg)
{
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......@@ -1065,7 +1065,7 @@ void fetchSafeControllerYamlParameters(ros::NodeHandle& nodeHandle)
void isReadyClientConfigYamlCallback(const IntWithHeader & msg)
{
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......@@ -1261,7 +1261,7 @@ int main(int argc, char* argv[])
// // Specify the Yaml filename as a string
// loadYamlFromFilenameCall.request.stringWithHeader.data = "DefaultController";
// // Set for whom this applies to
// loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForID = false;
// loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForAgentID = false;
// // Wait until the serivce exists
// requestLoadYamlFilenameServiceClient.waitForExistence(ros::Duration(-1));
// // Make the service call
......
......@@ -138,9 +138,9 @@ void requestLoadYamlFilenameCallback(const StringWithHeader& yaml_filename_to_lo
}
}
// Copy across the boolean field
yaml_ready_msg.shouldCheckForID = yaml_filename_to_load_with_header.shouldCheckForID;
yaml_ready_msg.shouldCheckForAgentID = yaml_filename_to_load_with_header.shouldCheckForAgentID;
// Copy across the vector of IDs
if (yaml_filename_to_load_with_header.shouldCheckForID)
if (yaml_filename_to_load_with_header.shouldCheckForAgentID)
{
for ( int i_ID=0 ; i_ID<yaml_filename_to_load_with_header.agentIDs.size() ; i_ID++ )
{
......
......@@ -1090,7 +1090,7 @@ void publish_current_xyz_yaw(float x, float y, float z, float yaw)
void isReadyPickerControllerYamlCallback(const IntWithHeader & msg)
{
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......@@ -1344,7 +1344,7 @@ int main(int argc, char* argv[]) {
// Specify the Yaml filename as a string
loadYamlFromFilenameCall.request.stringWithHeader.data = "PickerController";
// Set for whom this applies to
loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForID = false;
loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForAgentID = false;
// Wait until the serivce exists
requestLoadYamlFilenameServiceClient.waitForExistence(ros::Duration(-1));
// Make the service call
......
......@@ -716,7 +716,7 @@ void customCommandReceivedCallback(const CustomButtonWithHeader& commandReceived
void isReadyStudentControllerYamlCallback(const IntWithHeader & msg)
{
// Check whether the message is relevant
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForID , msg.agentIDs );
bool isRevelant = checkMessageHeader( m_agentID , msg.shouldCheckForAgentID , msg.agentIDs );
// Continue if the message is relevant
if (isRevelant)
......@@ -950,7 +950,7 @@ int main(int argc, char* argv[]) {
// Specify the Yaml filename as a string
loadYamlFromFilenameCall.request.stringWithHeader.data = "StudentController";
// Set for whom this applies to
loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForID = false;
loadYamlFromFilenameCall.request.stringWithHeader.shouldCheckForAgentID = false;
// Wait until the serivce exists
requestLoadYamlFilenameServiceClient.waitForExistence(ros::Duration(-1));
// Make the service call
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment