Couldn't find any wheel odometry packages for ROS2, so this is a simple one to get you going and expand upon if needed. Follow this step by step guide to get going, should be fairly straightforward, ...
Connect the Encoder to the D2 and D3 pins of the motherboard.You can use other pins if you want. 1.git clone this resp to your Arduino IDE'S libraries directory. 2 ...