robotpy / robotpy-rev

RobotPy bindings for REV Robotics' REVLib
Other
8 stars 13 forks source link

WIP: Initial stab at some autogen #5

Closed virtuald closed 5 years ago

virtuald commented 5 years ago

Leaving this here for now, I don't think I'll be able to get to it for awhile

Closes: #1

auscompgeek commented 5 years ago

I've cleaned it up a little bit and added a sphinxify call.

Unfortunately CppHeaderParser concatenates Doxygen comments that are "next to" each other, so we'll also have to check whether it looks like that's happened and pick out the last one.

Still haven't fixed overloaded functions either. I don't currently want to think about how that'll work in simulation either.

This is also still missing the ExternalFollower type.

auscompgeek commented 5 years ago

Just realised I deliberately made sphinxify incompatible with Python 3.5.

I tried to get Travis CI to build the sdist with Python 3.6 first, like so:

  - python: "3.5"
    install:
    # sphinxify doesn't support 3.5, so build the sdist using the system 3.6 first
    - /usr/bin/python3.6 -m pip install header2whatever sphinxify
    - /usr/bin/python3.6 setup.py sdist
    - pip install pytest coverage pytest-cov
    - "pip install dist/robotpy-rev-*.tar.gz"

... but unfortunately that didn't work.

I'm removing Python 3.5 from the CI config until we can come up with a solution (preferably one that doesn't involve me making another sphinxify release).

auscompgeek commented 5 years ago

Decided to ignore the problem of the overloaded methods. It seems to build now.

auscompgeek commented 5 years ago

I suspect the easiest way to get the overloaded functions working is to have an overload: true in the data, which the pybind11 template then checks and casts when specified. Simulation can then for now skip them and the methods can be added in sim_class_extra.

auscompgeek commented 5 years ago

Things that are missing now:

I will probably try compiling and loading this in the afternoon.

Wonder whether lambdas would've been better than casting to handle the method overloads.

Open question: what key should the CANSparkMax sim data go under, and should the sim data keys be named to make implementing the low-level getParameter easier?

virtuald commented 5 years ago

I think casting is probably better, because there's no extra function call to elide (or not elide).

auscompgeek commented 5 years ago

Ah, that's true. Getting the correct return type is hard though.

virtuald commented 5 years ago

I'll take a look at this in the afternoon. It seems like it's probably good enough for an initial (heavily caveated) release though?