Skip to content

Commit

Permalink
PositionControl: degrees to radians
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Mannhart authored and Dennis Mannhart committed Apr 6, 2018
1 parent 2f3e3f9 commit 54c87c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/modules/mc_pos_control/PositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ PositionControl::PositionControl()
MPC_THR_MIN_h = param_find("MPC_THR_MIN");
MPC_THR_MIN_h = param_find("MPC_MANTHR_MIN");
MPC_TILTMAX_AIR_h = param_find("MPC_TILTMAX_AIR");
MPC_MAN_TILT_MAX_h = param_find("MPC_MAN_TILT_MAX");
_parameter_sub = orb_subscribe(ORB_ID(parameter_update));

// set parameter the very first time
Expand Down Expand Up @@ -334,5 +335,8 @@ void PositionControl::_setParams()
param_get(MPC_THR_MIN_h, &MPC_THR_MIN);
param_get(MPC_MANTHR_MIN_h, &MPC_MANTHR_MIN);
param_get(MPC_TILTMAX_AIR_h, &MPC_TILTMAX_AIR);
MPC_TILTMAX_AIR = math::radians(MPC_TILTMAX_AIR);
param_get(MPC_MAN_TILT_MAX_h, &MPC_MAN_TILT_MAX);
MPC_MAN_TILT_MAX = math::radians(MPC_MAN_TILT_MAX);

}
6 changes: 3 additions & 3 deletions src/modules/mc_pos_control/PositionControl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace Controller
{
/** Constraints that depends on mode and are lower
* than the global limits.
* tilt_max: Cannot exceed PI/2
* tilt_max: Cannot exceed PI/2 radians
* vel_max_z_up: Cannot exceed maximum global velocity upwards
* @see MPC_TILTMAX_AIR
* @see MPC_Z_VEL_MAX_DN
Expand Down Expand Up @@ -198,8 +198,8 @@ class PositionControl
float MPC_XY_VEL_MAX{1.0f}; /**< maximum speed in the horizontal direction */
float MPC_Z_VEL_MAX_DN{1.0f}; /**< maximum speed in downwards direction */
float MPC_Z_VEL_MAX_UP{1.0f}; /**< maximum speed in upwards direction */
float MPC_TILTMAX_AIR{1.5}; /**< maximum tilt for any position/velocity controlled mode */
float MPC_MAN_TILT_MAX{3.1}; /**< maximum tilt for manual/altitude mode */
float MPC_TILTMAX_AIR{1.5}; /**< maximum tilt for any position/velocity controlled mode in radians */
float MPC_MAN_TILT_MAX{3.1}; /**< maximum tilt for manual/altitude mode in radians */

// Parameter handles
int _parameter_sub { -1 };
Expand Down

0 comments on commit 54c87c4

Please sign in to comment.