Control of piston trajectory in free piston combustion engine