Commit 503f4c5e authored by mastefan's avatar mastefan
Browse files

DroneXController Fetch Vicon Data

parent 2ce4c8cc
......@@ -345,7 +345,7 @@ void perControlCycleOperations();
// CALLBACK FROM ROS MESSAGES RECEIVED
void buttonPressedCallback(const std_msgs::Int32& msg);
void dronexCoordinateCallback(const ViconData& viconData);
// SEPARATE CALLBACK FUNCTIONS FOR EACH BUTTON
void buttonPressed_gotoStart();
......
......@@ -201,8 +201,8 @@ void buttonPressed_land(){
// CALLBACK FUNCTION THAT RUN WHEN THE RESPECTIVE BUTTON IS PRESSED
/*
void buttonPressed_gotoStart()
/*void buttonPressed_gotoStart()
{
ROS_INFO("[DRONEX CONTROLLER] Goto Start button pressed");
......@@ -984,6 +984,26 @@ void buttonPressedCallback(const std_msgs::Int32& msg)
void dronexCoordinateCallback(const ViconData& viconData){
CrazyflieData droneX;
for(std::vector<CrazyflieData>::const_iterator it = viconData.crazyflies.begin(); it != viconData.crazyflies.end(); ++it) {
CrazyflieData global = *it;
if(global.crazyflieName == "Mothership"){
droneX = global;
//coordinatesToLocal(droneX);
}
}
m_setpoint[0] = droneX.x;
m_setpoint[1] = droneX.y;
m_setpoint[2] = droneX.z+0.2;
m_setpoint[3] = droneX.yaw;
}
// ************************************************************************************************
// PPPP U U BBBB L III SSSS H H X X Y Y ZZZZZ Y Y A W W
// P P U U B B L I S H H X X Y Y Z Y Y A A W W
......@@ -1396,6 +1416,10 @@ int main(int argc, char* argv[]) {
// Subscribe to get Coordinates of Dronex
//ros::Subscriber dronexCoordinateSubscriber = nodeHandle.subscribe("dronexCoordinate", 1, dronexCoordinateCallback);
ros::Subscriber viconSubscriber = nodeHandle.subscribe("/ViconDataPublisher/ViconData", 100, dronexCoordinateCallback);
// Print out some information to the user.
ROS_INFO("[DroneX CONTROLLER] Service ready :-)");
......
......@@ -924,6 +924,7 @@ void loadPickerController()
// TODO
void loadDroneXController(){
ros::NodeHandle nodeHandle("~");
std::string droneXControllerName;
......
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