Skip to content

Commit

Permalink
Clean up test a little
Browse files Browse the repository at this point in the history
  • Loading branch information
jkflying committed Aug 7, 2019
1 parent 401060b commit e578b36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/CollisionPrevention/CollisionPreventionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ TEST_F(CollisionPreventionTest, testBehaviorOnWithAnObstacle)

// AND: a parameter handle
param_t param = param_handle(px4::params::MPC_COL_PREV_D);
float value = 10; // try to keep 10m distance
param_set(param, &value);

// AND: an obstacle message
obstacle_distance_s message;
Expand All @@ -120,11 +122,10 @@ TEST_F(CollisionPreventionTest, testBehaviorOnWithAnObstacle)
message.distances[i] = 101;
}

orb_advert_t obstacle_distance_pub = orb_advertise(ORB_ID(obstacle_distance), &message);


// WHEN: we publish the message and set the parameter and then run the setpoint modification
orb_advert_t obstacle_distance_pub = orb_advertise(ORB_ID(obstacle_distance), &message);
float value = 10;
param_set(param, &value);
matrix::Vector2f modified_setpoint = original_setpoint;
cp.modifySetpoint(modified_setpoint, max_speed, curr_pos, curr_vel);
orb_unadvertise(obstacle_distance_pub);
Expand Down

0 comments on commit e578b36

Please sign in to comment.