If I can monitor and measure the motor energy consumption

Hello

I am using Four XL430 motors to construct a small bipedal robot. I would like to measure and calculate the energy consumptions for each motors during the locomotion.

I am using the Dynamixel SDK in Matlab to control the motors. Is there any way I can measure the motor torques and motor energy consumption during the motor locomotion?