Skip to content

Commit

Permalink
change angle parmeter to degrees
Browse files Browse the repository at this point in the history
  • Loading branch information
baumanta authored and RomanBapst committed Aug 7, 2019
1 parent f80a539 commit e91614c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/lib/CollisionPrevention/CollisionPrevention.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ void CollisionPrevention::_calculateConstrainedSetpoint(Vector2f &setpoint,
//check if the bin must be considered regarding the given stick input
Vector2f bin_direction = {cos(angle), sin(angle)};

if (setpoint_dir.dot(bin_direction) > 0 && setpoint_dir.dot(bin_direction) > cosf(_param_mpc_col_prev_ang.get())) {
if (setpoint_dir.dot(bin_direction) > 0
&& setpoint_dir.dot(bin_direction) > cosf(math::radians(_param_mpc_col_prev_ang.get()))) {
//calculate max allowed velocity with a P-controller (same gain as in the position controller)
float curr_vel_parallel = math::max(0.f, curr_vel.dot(bin_direction));
float delay_distance = curr_vel_parallel * _param_mpc_col_prev_dly.get();
Expand Down
8 changes: 4 additions & 4 deletions src/lib/CollisionPrevention/collisionprevention_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ PARAM_DEFINE_FLOAT(MPC_COL_PREV_D, -1.0f);
PARAM_DEFINE_FLOAT(MPC_COL_PREV_DLY, 0.f);

/**
* Angle at which the vehicle can fly away from obstacles
* Angle left/right from the commanded setpoint in which the range data is used to calculate speed limitations. All data further from the commanded direction is not considered.
*
* Only used in Position mode.
*
* @min 0
* @max 1.570796
* @unit [rad]
* @max 90
* @unit [deg]
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_COL_PREV_ANG, 0.785f);
PARAM_DEFINE_FLOAT(MPC_COL_PREV_ANG, 45.f);

0 comments on commit e91614c

Please sign in to comment.