Skip to content

Commit

Permalink
[cv] fix possible divide by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkscheper authored and fvantienen committed Jan 25, 2019
1 parent 50f574d commit 638f513
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sw/airborne/modules/computer_vision/lib/vision/act_fast.c
Expand Up @@ -77,8 +77,8 @@ void act_fast(struct image_t *img, uint8_t fast_threshold, uint16_t *num_corners
// px, py represent the preferred direction of the agent when there is no texture
// here we initialize it differently for each agent:
// TODO: don't we have a randf function in Paparazzi?
px = ((float)(rand() % 10000)) / 10000.0f;
py = ((float)(rand() % 10000)) / 10000.0f;
px = ((float)(rand() % 10000) + 1) / 10000.0f;
py = ((float)(rand() % 10000) + 1) / 10000.0f;
pnorm = sqrtf(px * px + py * py);
struct agent_t ag = { (border + c * step_size_x), (border + r * step_size_y), 1, px / pnorm, py / pnorm};
agents[a] = ag;
Expand Down

0 comments on commit 638f513

Please sign in to comment.