hbrobotics / ros_arduino_bridge

ROS + Arduino = Robot
346 stars 334 forks source link

Encoder reading trouble #54

Closed didrif14 closed 6 years ago

didrif14 commented 6 years ago

We are trying to use this package for our differential drive robot. The left encoder is returning negative values, however when we modify the encoder_driver.ino with "0-left_enc_pos;" the left motor recieves 255 PWM singnal.

long readEncoder(int i)
{
if (i == LEFT) return 0-left_enc_pos;
else (i == RIGHT) return right_enc_pos;
}

It fixes the encoder values, but it affects somthing else. Same thing happens if we change the encoder wires.

Any tips on how to fix this?

didrif14 commented 6 years ago

Resolved