Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix motor run up distance #455

Merged
merged 4 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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