That looks like it should work unmodified – though your autonomous code will need to go under a “when autonomous” hat.
See this recent thread for more: