A hydraulic transmission, comprising: a variable displacement hydraulic pump, a variable displacement hydraulic motor, a drive shaft coupled to the hydraulic pump, for driving the hydraulic pump, and an output coupled to the hydraulic motor, for coupling to a load, wherein at least one of the hydraulic pump and the hydraulic motor comprises: a rotatable shaft, a shaft position sensor which senses the angular position of the rotatable shaft; at least one ring cam having one or more lobes, a plurality of cylinders arranged around the rotatable shaft and having working volumes which vary cyclically with rotation of the rotatable shaft, a low pressure working fluid line and a high pressure working fluid line, a plurality of valves (114, 120) regulating the flow of working fluid between each said cylinder and the low and high pressure working fluid lines, at least one said valve associated with each cylinder being an electronically controlled valve, a controller configured to actively control the said electronically controlled valves to thereby determine the net displacement of working fluid by each cylinder on each cycle of cylinder working volume, wherein the controller is configured to repeatedly execute a displacement determination algorithm, when the rotatable shaft is at angularly spaced positions, to thereby determine the net displacement of working fluid by each cylinder on each cycle of cylinder working volume, characterised in that the algorithm takes into account a displacement demand (Demand), and the difference between previous values of the displacement demand (Demand) and previous net displacements determined by the controller (Displacement(k)), to match the time averaged net displacement of working fluid by the cylinders to the time averaged displacement represented by the displacement demand (Demand). a variable displacement hydraulic pump, a variable displacement hydraulic motor, a drive shaft coupled to the hydraulic pump, for driving the hydraulic pump, and an output coupled to the hydraulic motor, for coupling to a load, a rotatable shaft, a shaft position sensor which senses the angular position of the rotatable shaft; at least one ring cam having one or more lobes, a plurality of cylinders arranged around the rotatable shaft and having working volumes which vary cyclically with rotation of the rotatable shaft, a low pressure working fluid line and a high pressure working fluid line, a plurality of valves (114, 120) regulating the flow of working fluid between each said cylinder and the low and high pressure working fluid lines, at least one said valve associated with each cylinder being an electronically controlled valve, a controller configured to actively control the said electronically controlled valves to thereby determine the net displacement of working fluid by each cylinder on each cycle of cylinder working volume, wherein the controller is configured to repeatedly execute a displacement determination algorithm, when the rotatable shaft is at angularly spaced positions, to thereby determine the net displacement of working fluid by each cylinder on each cycle of cylinder working volume, characterised in that the algorithm takes into account a displacement demand (Demand), and the difference between previous values of the displacement demand (Demand) and previous net displacements determined by the controller (Displacement(k)), to match the time averaged net displacement of working fluid by the cylinders to the time averaged displacement represented by the displacement demand (Demand).