altering angle being targeted when use_gyro
is active
#1897
Replies: 1 comment
-
I think you're on the right track. If you want to make that approach more similar with the other methods like 'straight' and 'turn', you can make it just so. For example, you could have a function such as: async def straight_but_veer_slightly(target_distance, veer_amount):
start_distance = robot.distance()
while robot.distance() - start_distance < target_distance:
robot.drive( ... ) # Use the logic you already made for this
await wait(10) # Await briefly to give other tasks a chance to run
robot.stop() This function now works similar to If you make your own logic to cancel tasks (such as with |
Beta Was this translation helpful? Give feedback.
-
As I understand it, enabling
use_gyro
for my DriveBase will affect various methods likecurve
andstraight
. For example, when usingstraight
withuse_gyro
enabled, I'm assumingstraight
identifies the current heading and maintains that heading with the pid controller.What I'd like to do is go
straight
whilst maintaining a heading that isn't exactly the heading at the start of going straight. I can actually do this with the DriveBase.drive method and constantly adjust the turn_rate based on what my current heading is versus my targeted heading. However, the second thing I want to do is use this functionality concurrently with other motors. DriveBase.drive doesn't seem to be awaitable and thus doesn't behave well in the multitask tool.My request to alter the heading being tracked when
use_gyro
is enabled is due to thestraight
method being awaitable.I accept that I might be thinking about this all incorrectly and am open to any suggestions that allows me to move straight maintaining a specific heading asynchronously.
I'm noticing that the API methods like run_target are awaitable while track_target are not. What is the reason for this?
Beta Was this translation helpful? Give feedback.
All reactions