Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <ucl_drone/drone_role.h>
00012
00013
00014 DroneRole::DroneRole(std::string name)
00015 {
00016 this->name = name;
00017 this->role = 1;
00018 }
00019
00020 DroneRole::~DroneRole()
00021 {
00022 }
00023
00024 void DroneRole::SetDroneRole(int role)
00025 {
00026 this->role = role;
00027 ROS_DEBUG("Role set: %d", role);
00028 }
00029
00030 void DroneRole::SetDroneRole(int role, std::vector< std::string > params)
00031 {
00032 this->role = role;
00033 this->parameters = params;
00034 ROS_DEBUG("Role set: %d", role);
00035 }
00036
00037 void DroneRole::SetDroneRole(int role, std::string param)
00038 {
00039 std::vector< std::string > params;
00040 params.push_back(param);
00041 this->SetDroneRole(role, params);
00042 }
00043
00044 void DroneRole::SetDroneRole(int role, int number_of_params, ...)
00045 {
00046 va_list vl;
00047 va_start(vl, number_of_params);
00048
00049 std::vector< std::string > params;
00050 params.resize(number_of_params);
00051 for (int i = 0; i < number_of_params; i++)
00052 {
00053 std::string param(va_arg(vl, char*));
00054 params.push_back(param);
00055 this->SetDroneRole(role, params);
00056 }
00057 va_end(vl);
00058 }
00059
00060 int DroneRole::GetDroneRole()
00061 {
00062 return role;
00063 }
00064
00065 ucl_drone::DroneRole DroneRole::DroneRoleToMsg()
00066 {
00067 ucl_drone::DroneRole msg;
00068 msg.name = this->name;
00069 msg.role = this->role;
00070 msg.params = this->parameters;
00071 return msg;
00072 }
00073
00074 void DroneRole::MsgToDroneRole()
00075 {
00076 }
00077
00078 ucl_drone::DroneRoles DroneRole::DroneRolesToMsg(std::vector< DroneRole > roles)
00079 {
00080 ucl_drone::DroneRoles msg;
00081 msg.roles.resize(roles.size());
00082 for (int i = 0; i < roles.size(); i++)
00083 {
00084 msg.roles[i] = roles[i].DroneRoleToMsg();
00085 }
00086 return msg;
00087 }