Skip to content
Snippets Groups Projects
Commit 738540ad authored by bucyril's avatar bucyril
Browse files

Changes to CircleController. Publishing proper data for FollowController

parent 80d4fcbc
No related branches found
No related tags found
No related merge requests found
......@@ -156,6 +156,15 @@ bool calculateControlOutput(Controller::Request &request, Controller::Response &
currentTime += request.ownCrazyflie.acquiringTime;
//publish setpoint for FollowController of another student group
Setpoint pubSetpoint;
pubSetpoint.x = request.ownCrazyflie.x;
pubSetpoint.y = request.ownCrazyflie.y;
pubSetpoint.z = request.ownCrazyflie.z;
pubSetpoint.yaw = request.ownCrazyflie.yaw;
followPublisher.publish(pubSetpoint);
//actual Circle Controller stuff follows
Setpoint circlePoint;
calculateCircle(circlePoint);
......@@ -207,13 +216,7 @@ bool calculateControlOutput(Controller::Request &request, Controller::Response &
previousLocation = request.ownCrazyflie;
Setpoint pubSetpoint;
pubSetpoint.x = previousLocation.x;
pubSetpoint.y = previousLocation.y;
pubSetpoint.z = previousLocation.z;
pubSetpoint.yaw = previousLocation.yaw;
followPublisher.publish(pubSetpoint);
return true;
}
......@@ -227,6 +230,7 @@ int main(int argc, char* argv[]) {
ros::NodeHandle nodeHandle("~");
loadParameters(nodeHandle);
//publisher for Follow Controller of another student group
followPublisher = nodeHandle.advertise<Setpoint>("FollowTopic", 1);
ros::ServiceServer service = nodeHandle.advertiseService("CircleController", calculateControlOutput);
......
......@@ -194,6 +194,7 @@ bool calculateControlOutput(Controller::Request &request, Controller::Response &
return true;
}
//the setpoint is copied from the other crazyflie. This crazyflie should then make the same figure in its own area
void followCallback(const Setpoint& newSetpoint) {
setpoint[0] = newSetpoint.x-0.1;
setpoint[1] = newSetpoint.y-0.1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment