Skip to main content Link Menu Expand (external link) Document Search Copy Copied

void addDistFn(double dist, std::function<void()> fn)

This function adds a function to be called when the robot is a certain distance away from the target.

Since this function uses the distance to the target when following a path, some curved paths might cause the function to be called at a different distance than expected.

Parameters

  • dist - The maximum distance away from the target to call the function
  • fn - The function to call

Example

//This will print "Hello World" when the robot is 5 inches away from the target
wc.addDistFn(5, []() {
  std::cout << "Hello World" << std::endl;
});