Hc020k Optic Encoder Direction of Motor

Hi, im trying the get odometry data via arduino uno and hc020k optic encoder. Is there a way to get direction of the motor?

That encoder has a single output so it can not give you direction. Use the direction that you are driving the motor to know whether to count up or down.

i will use with twist messages from ros teleop is it still viable with that

Sorry, I do not know what a twist message or ros telop are so can't say for sure.