RobotPy 2020: What do you want next?

There’s only so much time at night to work on things, and now that trajectory support is in, what do you want next most?

  • Documentation
  • Examples
  • CommandsV2
  • Shuffleboard objects
  • Fixing keepalive in CommandsV1
  • Make installation easy
  • Don’t care

0 voters

  • Documentation

I have been making some sample docs for our programmers yesterday and today (we are in the midst of a storm, and both school and robotics have been canceled). We may be able to help with the examples a bit. What paradigm do you want for the 2020 examples?
Update the current repo to work with robotpy2020?
Create a new 2020 examples repo?
or something else?

Also,
If anyone is confused about the implementation of robotpy 2020 before the documentation is updated (as we have been), the devs are really good about including helpful docstrings for all modules. So, running the help() method on a class which is giving you errors can help. This also helps in figuring out the import statements (which typically seem to follow that of the Java implementation. Examples of that can be found here, or in vscode).
See the example below.
~Mr. R^2

>>> from wpilib import kinematics
>>> help(kinematics)
Help on package wpilib.kinematics in wpilib:

NAME
    wpilib.kinematics

PACKAGE CONTENTS
    _init_kinematics
    _kinematics
    pkgcfg

CLASSES
    pybind11_builtins.pybind11_object(builtins.object)
        wpilib.kinematics._kinematics.ChassisSpeeds
        wpilib.kinematics._kinematics.DifferentialDriveKinematics
        wpilib.kinematics._kinematics.DifferentialDriveOdometry
        wpilib.kinematics._kinematics.DifferentialDriveWheelSpeeds
        wpilib.kinematics._kinematics.MecanumDriveKinematics
        wpilib.kinematics._kinematics.MecanumDriveOdometry
        wpilib.kinematics._kinematics.MecanumDriveWheelSpeeds

    class ChassisSpeeds(pybind11_builtins.pybind11_object)
     |  Method resolution order:
     |      ChassisSpeeds
     |      pybind11_builtins.pybind11_object
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      __init__(self: wpilib.kinematics._kinematics.ChassisSpeeds) -> None
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  fromFieldRelativeSpeeds(...) from builtins.PyCapsule
     |      fromFieldRelativeSpeeds(vx: meters_per_second, vy: meters_per_second, omega: radians_per_second, robotAngle: wpilib.geometry._geometry.Rotation2d) ->
wpilib.kinematics._kinematics.ChassisSpeeds
     |
     |      Converts a user provided field-relative set of speeds into a robot-relative
     |      ChassisSpeeds object.
     |
     |      :param vx: The component of speed in the x direction relative to the field.
     |                Positive x is away from your alliance wall.
     |
     |      :param vy: The component of speed in the y direction relative to the field.
     |                Positive y is to your left when standing behind the alliance wall.
     |
     |      :param omega: The angular rate of the robot.
     |
     |      :param robotAngle: The angle of the robot as measured by a gyroscope. The
     |                robot's angle is considered to be zero when it is facing directly away from
     |                your alliance station wall. Remember that this should be CCW positive.
     |
     |      :returns: ChassisSpeeds object representing the speeds in the robot's frame
     |                of reference.
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  omega
     |
     |  vx
     |
     |  vy
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from pybind11_builtins.pybind11_object:
     |
     |  __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
     |      Create and return a new object.  See help(type) for accurate signature.

    class DifferentialDriveKinematics(pybind11_builtins.pybind11_object)
     |  Method resolution order:
     |      DifferentialDriveKinematics
     |      pybind11_builtins.pybind11_object
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      __init__(self: wpilib.kinematics._kinematics.DifferentialDriveKinematics, trackWidth: meters) -> None
     |
     |      Constructs a differential drive kinematics object.
     |
     |      :param trackWidth: The track width of the drivetrain. Theoretically, this is
     |                the distance between the left wheels and right wheels. However, the
     |                empirical value may be larger than the physical measured value due to
     |                scrubbing effects.
     |
     |  toChassisSpeeds(...)
     |      toChassisSpeeds(self: wpilib.kinematics._kinematics.DifferentialDriveKinematics, wheelSpeeds: frc::DifferentialDriveWheelSpeeds) -> wpilib.kinematics._kinematics.ChassisSpeeds
     |
     |      Returns a chassis speed from left and right component velocities using
     |      forward kinematics.
     |
     |      :param wheelSpeeds: The left and right velocities.
     |
     |      :returns: The chassis speed.
     |
     |  toWheelSpeeds(...)
     |      toWheelSpeeds(self: wpilib.kinematics._kinematics.DifferentialDriveKinematics, chassisSpeeds: wpilib.kinematics._kinematics.ChassisSpeeds) -> frc::DifferentialDriveWheelSpeeds
     |
     |      Returns left and right component velocities from a chassis speed using
     |      inverse kinematics.
     |
     |      :param chassisSpeeds: The linear and angular (dx and dtheta) components that
     |                   represent the chassis' speed.
     |
     |      :returns: The left and right velocities.
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  trackWidth
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from pybind11_builtins.pybind11_object:
     |
     |  __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
     |      Create and return a new object.  See help(type) for accurate signature.

    class DifferentialDriveOdometry(pybind11_builtins.pybind11_object)
     |  Method resolution order:
     |      DifferentialDriveOdometry
     |      pybind11_builtins.pybind11_object
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      __init__(self: wpilib.kinematics._kinematics.DifferentialDriveOdometry, gyroAngle: wpilib.geometry._geometry.Rotation2d, initialPose: wpilib.geometry._geometry.Pose2d = <wpilib.geometry._geometry.Pose2d object at 0x000001A68F5135F0>) -> None
     |
     |      Constructs a DifferentialDriveOdometry object.
     |
     |      :param gyroAngle: The angle reported by the gyroscope.
     |
     |      :param initialPose: The starting position of the robot on the field.
     |
     |  getPose(...)
     |      getPose(self: wpilib.kinematics._kinematics.DifferentialDriveOdometry) -> wpilib.geometry._geometry.Pose2d
     |
     |      Returns the position of the robot on the field.
     |
     |      :returns: The pose of the robot.
     |
     |  resetPosition(...)
     |      resetPosition(self: wpilib.kinematics._kinematics.DifferentialDriveOdometry, pose: wpilib.geometry._geometry.Pose2d, gyroAngle: wpilib.geometry._geometry.Rotation2d) -> None
     |
     |      Resets the robot's position on the field.
     |
     |      You NEED to reset your encoders (to zero) when calling this method.
     |
     |      The gyroscope angle does not need to be reset here on the user's robot
     |      code. The library automatically takes care of offsetting the gyro angle.
     |
     |      :param pose: The position on the field that your robot is at.
     |
     |      :param gyroAngle: The angle reported by the gyroscope.
     |
     |  update(...)
     |      update(self: wpilib.kinematics._kinematics.DifferentialDriveOdometry, gyroAngle: wpilib.geometry._geometry.Rotation2d, leftDistance: meters, rightDistance: meters) -> wpilib.geometry._geometry.Pose2d
     |
     |      Updates the robot position on the field using distance measurements from
     |      encoders. This method is more numerically accurate than using velocities to
     |      integrate the pose and is also advantageous for teams that are using lower
     |      CPR encoders.
     |
     |      :param gyroAngle: The angle reported by the gyroscope.
     |
     |      :param leftDistance: The distance traveled by the left encoder.
     |
     |      :param rightDistance: The distance traveled by the right encoder.
     |
     |      :returns: The new pose of the robot.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from pybind11_builtins.pybind11_object:
     |
     |  __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
     |      Create and return a new object.  See help(type) for accurate signature.

    class DifferentialDriveWheelSpeeds(pybind11_builtins.pybind11_object)
     |  Method resolution order:
     |      DifferentialDriveWheelSpeeds
     |      pybind11_builtins.pybind11_object
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      __init__(self: wpilib.kinematics._kinematics.DifferentialDriveWheelSpeeds) -> None
     |
     |  normalize(...)
     |      normalize(self: wpilib.kinematics._kinematics.DifferentialDriveWheelSpeeds, attainableMaxSpeed: meters_per_second) -> None
     |
     |      Normalizes the wheel speeds using some max attainable speed. Sometimes,
     |      after inverse kinematics, the requested speed from a/several modules may be
     |      above the max attainable speed for the driving motor on that module. To fix
     |      this issue, one can "normalize" all the wheel speeds to make sure that all
     |      requested module speeds are below the absolute threshold, while maintaining
     |      the ratio of speeds between modules.
     |
     |      :param attainableMaxSpeed: The absolute max speed that a wheel can reach.
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  left
     |
     |  right
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from pybind11_builtins.pybind11_object:
     |
     |  __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
     |      Create and return a new object.  See help(type) for accurate signature.

    class MecanumDriveKinematics(pybind11_builtins.pybind11_object)
     |  Method resolution order:
     |      MecanumDriveKinematics
     |      pybind11_builtins.pybind11_object
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      __init__(self: wpilib.kinematics._kinematics.MecanumDriveKinematics, frontLeftWheel: wpilib.geometry._geometry.Translation2d, frontRightWheel: wpilib.geometry._geometry.Translation2d, rearLeftWheel: wpilib.geometry._geometry.Translation2d, rearRightWheel: wpilib.geometry._geometry.Translation2d) -> None
     |
     |      Constructs a mecanum drive kinematics object.
     |
     |      :param frontLeftWheel: The location of the front-left wheel relative to the
     |                     physical center of the robot.
     |
     |      :param frontRightWheel: The location of the front-right wheel relative to
     |                     the physical center of the robot.
     |
     |      :param rearLeftWheel: The location of the rear-left wheel relative to the
     |                     physical center of the robot.
     |
     |      :param rearRightWheel: The location of the rear-right wheel relative to the
     |                     physical center of the robot.
     |
     |  toChassisSpeeds(...)
     |      toChassisSpeeds(self: wpilib.kinematics._kinematics.MecanumDriveKinematics, wheelSpeeds: frc::MecanumDriveWheelSpeeds) -> wpilib.kinematics._kinematics.ChassisSpeeds
     |
     |      Performs forward kinematics to return the resulting chassis state from the
     |      given wheel speeds. This method is often used for odometry -- determining
     |      the robot's position on the field using data from the real-world speed of
     |      each wheel on the robot.
     |
     |      :param wheelSpeeds: The current mecanum drive wheel speeds.
     |
     |      :returns: The resulting chassis speed.
     |
     |  toWheelSpeeds(...)
     |      toWheelSpeeds(self: wpilib.kinematics._kinematics.MecanumDriveKinematics, chassisSpeeds: wpilib.kinematics._kinematics.ChassisSpeeds, centerOfRotation: wpilib.geometry._geometry.Translation2d = <wpilib.geometry._geometry.Translation2d object at 0x000001A68F512030>) -> frc::MecanumDriveWheelSpeeds
     |
     |      Performs inverse kinematics to return the wheel speeds from a desired
     |      chassis velocity. This method is often used to convert joystick values into
     |      wheel speeds.
     |
     |      This function also supports variable centers of rotation. During normal
     |      operations, the center of rotation is usually the same as the physical
     |      center of the robot; therefore, the argument is defaulted to that use case.
     |      However, if you wish to change the center of rotation for evasive
     |      manuevers, vision alignment, or for any other use case, you can do so.
     |
     |      :param chassisSpeeds: The desired chassis speed.
     |
     |      :param centerOfRotation: The center of rotation. For example, if you set the
     |                      center of rotation at one corner of the robot and
     |                      provide a chassis speed that only has a dtheta
     |                      component, the robot will rotate around that
     |                      corner.
     |
     |      :returns: The wheel speeds. Use caution because they are not normalized.
     |                Sometimes, a user input may cause one of the wheel speeds to go
     |                above the attainable max velocity. Use the
     |                MecanumDriveWheelSpeeds::Normalize() function to rectify this
     |                issue. In addition, you can leverage the power of C++17 to directly
     |                assign the wheel speeds to variables:
     |
     |                @code{.cpp}
     |                auto [fl, fr, bl, br] = kinematics.ToWheelSpeeds(chassisSpeeds);
     |                @endcode
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from pybind11_builtins.pybind11_object:
     |
     |  __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
     |      Create and return a new object.  See help(type) for accurate signature.

    class MecanumDriveOdometry(pybind11_builtins.pybind11_object)
     |  Method resolution order:
     |      MecanumDriveOdometry
     |      pybind11_builtins.pybind11_object
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      __init__(self: wpilib.kinematics._kinematics.MecanumDriveOdometry, kinematics: wpilib.kinematics._kinematics.MecanumDriveKinematics, gyroAngle: wpilib.geometry._geometry.Rotation2d, initialPose: wpilib.geometry._geometry.Pose2d = <wpilib.geometry._geometry.Pose2d object at 0x000001A68E7E8E70>) -> None
     |
     |      Constructs a MecanumDriveOdometry object.
     |
     |      :param kinematics: The mecanum drive kinematics for your drivetrain.
     |
     |      :param gyroAngle: The angle reported by the gyroscope.
     |
     |      :param initialPose: The starting position of the robot on the field.
     |
     |  getPose(...)
     |      getPose(self: wpilib.kinematics._kinematics.MecanumDriveOdometry) -> wpilib.geometry._geometry.Pose2d
     |
     |      Returns the position of the robot on the field.
     |
     |      :returns: The pose of the robot.
     |
     |  resetPosition(...)
     |      resetPosition(self: wpilib.kinematics._kinematics.MecanumDriveOdometry, pose: wpilib.geometry._geometry.Pose2d, gyroAngle: wpilib.geometry._geometry.Rotation2d) -> None
     |
     |      Resets the robot's position on the field.
     |
     |      The gyroscope angle does not need to be reset here on the user's robot
     |      code. The library automatically takes care of offsetting the gyro angle.
     |
     |      :param pose: The position on the field that your robot is at.
     |
     |      :param gyroAngle: The angle reported by the gyroscope.
     |
     |  update(...)
     |      update(self: wpilib.kinematics._kinematics.MecanumDriveOdometry, gyroAngle: wpilib.geometry._geometry.Rotation2d, wheelSpeeds: frc::MecanumDriveWheelSpeeds) -> wpilib.geometry._geometry.Pose2d
     |
     |      Updates the robot's position on the field using forward kinematics and
     |      integration of the pose over time. This method automatically calculates
     |      the current time to calculate period (difference between two timestamps).
     |      The period is used to calculate the change in distance from a velocity.
     |      This also takes in an angle parameter which is used instead of the
     |      angular rate that is calculated from forward kinematics.
     |
     |      :param gyroAngle: The angle reported by the gyroscope.
     |
     |      :param wheelSpeeds: The current wheel speeds.
     |
     |      :returns: The new pose of the robot.
     |
     |  updateWithTime(...)
     |      updateWithTime(self: wpilib.kinematics._kinematics.MecanumDriveOdometry, currentTime: seconds, gyroAngle: wpilib.geometry._geometry.Rotation2d, wheelSpeeds: frc::MecanumDriveWheelSpeeds) -> wpilib.geometry._geometry.Pose2d
     |
     |      Updates the robot's position on the field using forward kinematics and
     |      integration of the pose over time. This method takes in the current time as
     |      a parameter to calculate period (difference between two timestamps). The
     |      period is used to calculate the change in distance from a velocity. This
     |      also takes in an angle parameter which is used instead of the
     |      angular rate that is calculated from forward kinematics.
     |
     |      :param currentTime: The current time.
     |
     |      :param gyroAngle: The angle reported by the gyroscope.
     |
     |      :param wheelSpeeds: The current wheel speeds.
     |
     |      :returns: The new pose of the robot.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from pybind11_builtins.pybind11_object:
     |
     |  __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
     |      Create and return a new object.  See help(type) for accurate signature.

    class MecanumDriveWheelSpeeds(pybind11_builtins.pybind11_object)
     |  Method resolution order:
     |      MecanumDriveWheelSpeeds
     |      pybind11_builtins.pybind11_object
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      __init__(self: wpilib.kinematics._kinematics.MecanumDriveWheelSpeeds) -> None
     |
     |  normalize(...)
     |      normalize(self: wpilib.kinematics._kinematics.MecanumDriveWheelSpeeds, attainableMaxSpeed: meters_per_second) -> None
     |
     |      Normalizes the wheel speeds using some max attainable speed. Sometimes,
     |      after inverse kinematics, the requested speed from a/several modules may be
     |      above the max attainable speed for the driving motor on that module. To fix
     |      this issue, one can "normalize" all the wheel speeds to make sure that all
     |      requested module speeds are below the absolute threshold, while maintaining
     |      the ratio of speeds between modules.
     |
     |      :param attainableMaxSpeed: The absolute max speed that a wheel can reach.
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  frontLeft
     |
     |  frontRight
     |
     |  rearLeft
     |
     |  rearRight
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from pybind11_builtins.pybind11_object:
     |
     |  __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
     |      Create and return a new object.  See help(type) for accurate signature.

DATA
    __all__ = ['ChassisSpeeds', 'DifferentialDriveKinematics', 'Differenti...
1 Like

Update the current examples repo to work with 2020. Some of that work has already been done, but more remains.

1 Like

Great, thank you. I can see what we can do. We do not meet until tomorrow, and cannot test on an actual robot without a meeting, but if we get some working reproducible examples, we will file a PR.

If examples work in simulation, that’s usually good enough.

1 Like