Skip to content

Commit

Permalink
call reset in encoders setup()
Browse files Browse the repository at this point in the history
  • Loading branch information
fjp committed Apr 30, 2021
1 parent f4646a8 commit afe7fbd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion diffbot_base/scripts/encoders/encoders/encoders.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Encoder encoderRight(7, 8); // Default pins 7, 8
ros::NodeHandle nh;

// ROS Subscriber setup to reset both encoders to zero
void resetCallback( const std_msgs::Empty& reset){
void resetCallback( const std_msgs::Empty& reset)
{
//digitalWrite(13, HIGH-digitalRead(13)); // blink the led
// reset both back to zero.
encoderLeft.write(0);
Expand All @@ -54,6 +55,8 @@ void setup()
nh.spinOnce();
}
nh.loginfo("Initialize DiffBot Wheel Encoders");
std_msgs::Empty reset;
resetCallback(reset);
delay(1);
}

Expand Down

0 comments on commit afe7fbd

Please sign in to comment.