Skip to content
Snippets Groups Projects
Commit 66786e59 authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Fixed some small BUUUUUGGGGGGGSSSS so that the student controller service now...

Fixed some small BUUUUUGGGGGGGSSSS so that the student controller service now compiles, mainly missing semi-colons from Jeremys edits because he is not able to compile on his machine to find these BUGGGGGSSS
parent 759c4da3
No related branches found
No related tags found
No related merge requests found
...@@ -134,4 +134,4 @@ void constructNamespaceForCoordinatorParameterService( int coordID, std::string ...@@ -134,4 +134,4 @@ void constructNamespaceForCoordinatorParameterService( int coordID, std::string
bool checkMessageHeader( int agentID , bool shouldCheckForAgentID , const std::vector<uint> & agentIDs ); bool checkMessageHeader( int agentID , bool shouldCheckForAgentID , const std::vector<uint> & agentIDs );
// FUNCTION FOR CONVERTING NEWTON TO MOTOR COMMAND // FUNCTION FOR CONVERTING NEWTON TO MOTOR COMMAND
float newtons2cmd_for_crazyflie( float thrust) float newtons2cmd_for_crazyflie( float thrust);
\ No newline at end of file \ No newline at end of file
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
// Include the DFALL service types // Include the DFALL service types
#include "dfall_pkg/LoadYamlFromFilename.h" #include "dfall_pkg/LoadYamlFromFilename.h"
#include "dfall_pkg/GetSetpointService.h" #include "dfall_pkg/GetSetpointService.h"
#include "dfall_pkg/GetDebugValuesService.h"
// Include the shared definitions // Include the shared definitions
#include "nodes/Constants.h" #include "nodes/Constants.h"
......
...@@ -266,15 +266,15 @@ float newtons2cmd_for_crazyflie( float thrust) ...@@ -266,15 +266,15 @@ float newtons2cmd_for_crazyflie( float thrust)
// Compute the 16-bit command that would produce the requested // Compute the 16-bit command that would produce the requested
// "thrust" based on the quadratic mapping that is described // "thrust" based on the quadratic mapping that is described
// by the coefficients in the "yaml_motorPoly" variable. // by the coefficients in the "yaml_motorPoly" variable.
float motoPoly = [5.484560e-4, 1.032633e-6, 2.130295e-11] static float motorPoly[3] = {5.484560e-4, 1.032633e-6, 2.130295e-11};
float cmd_16bit = (-motorPoly[1] + sqrt(motorPoly[1] * motorPoly[1] - 4 * motorPoly[2] * (motorPoly[0] - thrust))) / (2 * motorPoly[2]); float cmd_16bit = (-motorPoly[1] + sqrt(motorPoly[1] * motorPoly[1] - 4 * motorPoly[2] * (motorPoly[0] - thrust))) / (2 * motorPoly[2]);
// Clip the cmd_16bit to avoid wrapping // Clip the cmd_16bit to avoid wrapping
if cmd_16bit > 60000 if (cmd_16bit > 60000)
cmd_16bit = 60000 cmd_16bit = 60000;
else if cmd_16bit < 2000 else if (cmd_16bit < 2000)
cmd_16bit = 0 cmd_16bit = 0;
// Return the result // Return the result
return cmd_16bit; return cmd_16bit;
......
...@@ -51,13 +51,13 @@ ...@@ -51,13 +51,13 @@
// VARIABLES FOR VALUES LOADED FROM THE YAML FILE // VARIABLES FOR VALUES LOADED FROM THE YAML FILE
// > the proportional gain for z control // > the proportional gain for z control
float yaml_kp_z = 1.0 float yaml_kp_z = 1.0;
// > the derivative gain for z control // > the derivative gain for z control
float yaml_kd_z = 1.0 float yaml_kd_z = 1.0;
// > the integral gain for z control // > the integral gain for z control
float yaml_ki_z = 1.0 float yaml_ki_z = 1.0;
...@@ -322,7 +322,7 @@ bool calculateControlOutput(Controller::Request &request, Controller::Response & ...@@ -322,7 +322,7 @@ bool calculateControlOutput(Controller::Request &request, Controller::Response &
// Put the computed thrust adjustment into the "response" variable. // Put the computed thrust adjustment into the "response" variable.
// > On top of the thrust adjustment, we must add the feed-forward thrust // > On top of the thrust adjustment, we must add the feed-forward thrust
+ // to counter-act gravity. // to counter-act gravity.
// > NOTE: remember that the thrust is commanded per motor, so you sohuld // > NOTE: remember that the thrust is commanded per motor, so you sohuld
// consider whether the "thrustAdjustment" computed by your // consider whether the "thrustAdjustment" computed by your
// controller needed to be divided by 4 or not. // controller needed to be divided by 4 or not.
......
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