Skip to content

Commit

Permalink
Revert "Set motor to start max velocity at start (#464)"
Browse files Browse the repository at this point in the history
This reverts commit ef1c942.
  • Loading branch information
subinsaji authored Jul 18, 2024
1 parent ef1c942 commit 0a76bba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/ophyd_async/epics/motion/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ async def prepare(self, value: FlyMotorInfo):
)

await self.set(fly_prepared_position)
await self.velocity.set(fly_velocity)

@AsyncStatus.wrap
async def kickoff(self):
Expand Down Expand Up @@ -183,7 +182,7 @@ async def stop(self, success=False):
async def _prepare_velocity(
self, start_position: float, end_position: float, time_for_move: float
) -> float:
fly_velocity = (end_position - start_position) / time_for_move
fly_velocity = (start_position - end_position) / time_for_move
max_speed, egu = await asyncio.gather(
self.max_velocity.get_value(), self.motor_egu.get_value()
)
Expand All @@ -192,8 +191,7 @@ async def _prepare_velocity(
f"Motor speed of {abs(fly_velocity)} {egu}/s was requested for a motor "
f" with max speed of {max_speed} {egu}/s"
)
# move to prepare position at maximum velocity
await self.velocity.set(abs(max_speed))
await self.velocity.set(abs(fly_velocity))
return fly_velocity

async def _prepare_motor_path(
Expand Down
5 changes: 1 addition & 4 deletions tests/epics/motion/test_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,7 @@ async def test_valid_prepare_velocity(sim_motor: motor.Motor):
fly_info.end_position,
fly_info.time_for_move,
)
assert (
await sim_motor.velocity.get_value() == await sim_motor.max_velocity.get_value()
)
assert await sim_motor.velocity.get_value() == 10


@pytest.mark.parametrize(
Expand Down Expand Up @@ -296,7 +294,6 @@ async def wait_for_status(status: AsyncStatus):
)
# Test that prepare is not marked as complete until correct position is reached
await asyncio.gather(do_set(status), wait_for_status(status))
assert await sim_motor.velocity.get_value() == 10
assert status.done


Expand Down

0 comments on commit 0a76bba

Please sign in to comment.