A method for estimating an angle offset of an angle sensor in a system comprising: a permanent-magnet synchronous motor configured to drive an axle, wherein the angle sensor is configured to sense a rotor angle of a rotor of the permanent-magnet synchronous motor, and wherein the angle offset represents a difference between a sensed rotor angle and an actual rotor angle, and a brake arranged such that when the brake is closed, the brake manually prevents the axle from rotating, and when the brake is open, the axle is free to rotate, characterized in that the method comprises a first stage and then a second stage, wherein the first stage comprises: controlling stator phases of the motor to the same potential in order to short-circuit the stator of the motor, opening the brake, determining an angle of a stator current vector of the motor in a stator reference frame, the stator current vector being induced by rotation of the axle caused by an external torque acting on the axle, and determining an initial value for the estimated angle offset on the basis of the determined angle of the stator current vector, wherein the second stage comprises: determining a corrected rotor angle on the basis of the estimated angle offset and the rotor angle sensed with the angle sensor, controlling the torque of the motor to maintain the rotational speed of the motor at a zero speed, wherein the control of the torque uses the corrected rotor angle as feedback, making adjustments to the value of the estimated angle offset, determining a value of the estimated angle offset at which the magnitude of the stator current vector is at its minimum, and using the determined value as a final estimated angle offset. a permanent-magnet synchronous motor configured to drive an axle, wherein the angle sensor is configured to sense a rotor angle of a rotor of the permanent-magnet synchronous motor, and wherein the angle offset represents a difference between a sensed rotor angle and an actual rotor angle, and a brake arranged such that when the brake is closed, the brake manually prevents the axle from rotating, and when the brake is open, the axle is free to rotate, characterized in that the method comprises a first stage and then a second stage, wherein the first stage comprises: controlling stator phases of the motor to the same potential in order to short-circuit the stator of the motor, opening the brake, determining an angle of a stator current vector of the motor in a stator reference frame, the stator current vector being induced by rotation of the axle caused by an external torque acting on the axle, and determining an initial value for the estimated angle offset on the basis of the determined angle of the stator current vector, controlling stator phases of the motor to the same potential in order to short-circuit the stator of the motor, opening the brake, determining an angle of a stator current vector of the motor in a stator reference frame, the stator current vector being induced by rotation of the axle caused by an external torque acting on the axle, and determining an initial value for the estimated angle offset on the basis of the determined angle of the stator current vector, wherein the second stage comprises: determining a corrected rotor angle on the basis of the estimated angle offset and the rotor angle sensed with the angle sensor, controlling the torque of the motor to maintain the rotational speed of the motor at a zero speed, wherein the control of the torque uses the corrected rotor angle as feedback, making adjustments to the value of the estimated angle offset, determining a value of the estimated angle offset at which the magnitude of the stator current vector is at its minimum, and using the determined value as a final estimated angle offset. determining a corrected rotor angle on the basis of the estimated angle offset and the rotor angle sensed with the angle sensor, controlling the torque of the motor to maintain the rotational speed of the motor at a zero speed, wherein the control of the torque uses the corrected rotor angle as feedback, making adjustments to the value of the estimated angle offset, determining a value of the estimated angle offset at which the magnitude of the stator current vector is at its minimum, and using the determined value as a final estimated angle offset.