Skip to content

Commit

Permalink
Fix motor run up distance (#455)
Browse files Browse the repository at this point in the history
* Add factor of 1/2 when calculating run-up distance
  • Loading branch information
olliesilvester authored Jul 17, 2024
1 parent a667627 commit 8a9b9ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/ophyd_async/epics/motion/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ async def _prepare_motor_path(
) -> float:
# Distance required for motor to accelerate from stationary to fly_velocity, and
# distance required for motor to decelerate from fly_velocity to stationary
run_up_distance = (await self.acceleration_time.get_value()) * fly_velocity
run_up_distance = (
(await self.acceleration_time.get_value()) * fly_velocity * 0.5
)

self._fly_completed_position = end_position + run_up_distance

Expand Down
10 changes: 5 additions & 5 deletions tests/epics/motion/test_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ async def test_valid_prepare_velocity(sim_motor: motor.Motor):
"acceleration_time, velocity, start_position, end_position, upper_limit,\
lower_limit",
[
(1, 10, 0, 10, 30, -9.999), # Goes below lower_limit, +ve direction
(1, 10, 0, 10, 19.99, -10), # Goes above upper_limit, +ve direction
(1, 10, 0, 10, 30, -4.999), # Goes below lower_limit, +ve direction
(1, 10, 0, 10, 14.99, -10), # Goes above upper_limit, +ve direction
(1, -10, 10, 0, -30, -9.999), # Goes below lower_limit, -ve direction
(1, -10, 10, 0, 19.99, -10), # Goes above upper_limit, -ve direction
(1, -10, 10, 0, 14.99, -10), # Goes above upper_limit, -ve direction
],
)
async def test_prepare_motor_path_errors(
Expand Down Expand Up @@ -258,9 +258,9 @@ async def test_prepare_motor_path(sim_motor: motor.Motor):
await sim_motor._prepare_motor_path(
10, fly_info.start_position, fly_info.end_position
)
== -10
== -5
)
assert sim_motor._fly_completed_position == 20
assert sim_motor._fly_completed_position == 15


async def test_prepare(sim_motor: motor.Motor):
Expand Down

0 comments on commit 8a9b9ac

Please sign in to comment.