Skip to content

joystick: make axis selection/remapping dynamic #2524

@ES-Alexander

Description

@ES-Alexander

Current behaviour

ArduSub supports axis remapping in a very limited way with its roll-pitch-toggle Manual Control button function, but users have no control over which axes are switched, and we're generally trying to move away from autopilot firmware needing to interpret and remap user inputs. That functionality is also not available outside of ArduSub, which is needlessly restrictive.

Before #2519 it was (awkwardly) possible to swap between Cockpit's joystick profiles to have a quick-ish way of switching axes, but that was unintuitive (partly due to fixed profile names), required manually keeping button function changes in sync between the relevant joystick profiles, and required opening up Cockpit settings for a functionality that should be possible during operation.

Expected or desired behaviour

Controllers with few sticks/triggers should still be able to switch between which axes they're controlling at a time.

#2476 at least opens the door to doing this more generally, but it's still via somewhat awkward workarounds (requiring a bunch of custom logic and data-lake variables, and likely hard to configure intuitively).

  1. Ideally we can add some kind of axis switching/toggling feature/Action, where users can specify which axes they want to swap for what
    • This may be a fair amount of code for somewhat limited gain
    • If we have an API for setting the axes, we could create a default custom JS Action that mimics our roll-pitch toggle but allows users to edit it and change the axes involved
      • Bonus points if we automatically remap existing roll-pitch-toggle button functions to use this instead
    • There should be a notification when the axes change, so users are aware of what's happening (including if they accidentally press a button)
  2. Alternatively we could add the joystick axis selections to the data-lake, so users could just create their own Action to swap the active axes (without needing to mess with the manual control output details)
    • This likely doesn't require much code, but could be confusing to make sense of/configure
  3. This functionality could conceivably be implemented in the firmware, but I think that's really not a good way of doing it, and would be moving away from where we're trying to go.

Additional Context

This has been requested previously, particularly given inconsistency between desired switching axes (which implies users should have control over it, vs just having a good default).

Prerequisites

  • I have checked to make sure that a similar request has not already been filed or fixed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions