-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python stuff #19
Python stuff #19
Changes from all commits
d3899d9
38d3da7
1f394a7
4d26963
aad7a30
19e615c
41415f3
b57e5a3
0d86e2e
4029c2d
a7b752d
fdb0363
372c580
ea7607f
68eea59
c410ad6
4081e4d
ced51de
1549ee6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,31 +26,73 @@ and tracks the dome position using an encoder. It returns infomation | |||||||||
The c++ code is built around Software Bisque's X2 standard. For more | ||||||||||
infomation on this `see here <https://www.bisque.com/x2standard/class_x2_dome.html#a7ffd792950cdd0abe1b022e7a8caff9e>`. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
C++/gRPC Component | ||||||||||
================== | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
Requirements | ||||||||||
--------------- | ||||||||||
------------ | ||||||||||
|
||||||||||
``grpc python`` See instructions `here <https://grpc.io/docs/quickstart/python/>`_. | ||||||||||
``grpc c++`` See instructions `here <https://grpc.io/docs/quickstart/cpp/>`_. | ||||||||||
``grpc python`` For reference see `here <https://grpc.io/docs/quickstart/python/>`_. | ||||||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ||||||||||
|
||||||||||
Getting Started | ||||||||||
--------------- | ||||||||||
To install (on MacOS or Linux) the required grpc python packages run the following:: | ||||||||||
|
||||||||||
The code for the Huntsman dome driver is contained in the | ||||||||||
``domehunter/protos/src`` directory. This directory contains both | ||||||||||
human written files and files automatically generated by gRPC | ||||||||||
tools. The human written files are, | ||||||||||
python -m pip install --upgrade pip | ||||||||||
python -m pip install grpcio | ||||||||||
python -m pip install grpcio-tools | ||||||||||
|
||||||||||
* ``main.cpp`` - establishes main library to X2 driver (mostly copy/paste from example) | ||||||||||
* ``main.h`` - header for main.cpp | ||||||||||
* ``x2dome.cpp`` - the library code that serves the RPC from TSX to python server | ||||||||||
* ``x2dome.h`` - header for x2dome.cpp | ||||||||||
* ``hx2dome.proto`` - language agnostic RPC definitions used by everthing | ||||||||||
* ``hx2dome.proto_server.py`` - python server that receives RPC from TSX | ||||||||||
|
||||||||||
The remaining cpp and python files are automatically produced | ||||||||||
by gRPC and shouldn't need to be looked at. If for some reason | ||||||||||
you want to generate these files yourself, see the | ||||||||||
*gRPC automatically generated files* section below. | ||||||||||
``grpc c++`` For reference see `here <https://grpc.io/docs/quickstart/cpp/>`_. | ||||||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------ | ||||||||||
|
||||||||||
Detailed instructions to install from source on any OS can be found `here <https://github.com/grpc/grpc/blob/master/BUILDING.md>`_. | ||||||||||
|
||||||||||
For convenience a summary of the required steps is given below. | ||||||||||
|
||||||||||
To install depedencies for a linux OS, run the following:: | ||||||||||
|
||||||||||
[sudo] apt-get install build-essential autoconf libtool pkg-config | ||||||||||
[sudo] apt-get install libgflags-dev libgtest-dev | ||||||||||
[sudo] apt-get install clang libc++-dev | ||||||||||
|
||||||||||
To do the same on MacOS (with homebrew installed), run:: | ||||||||||
|
||||||||||
[sudo] xcode-select --install | ||||||||||
brew install autoconf automake libtool shtool | ||||||||||
brew install gflags | ||||||||||
|
||||||||||
Now to build grpc from source on Linux or MacOS run the following:: | ||||||||||
|
||||||||||
cd /usr/local/bin/ | ||||||||||
git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc | ||||||||||
cd grpc/ | ||||||||||
git submodule update --init | ||||||||||
make | ||||||||||
make install | ||||||||||
cd third_party/protobuf/ | ||||||||||
git submodule update --init --recursive | ||||||||||
./autogen.sh | ||||||||||
./configure | ||||||||||
make | ||||||||||
make check | ||||||||||
make install | ||||||||||
|
||||||||||
|
||||||||||
Alternatively to installing from source, you can install via homebrew on MacOS by running:: | ||||||||||
|
||||||||||
brew tap grpc/grpc | ||||||||||
brew install -s -- --with-plugins grpc | ||||||||||
brew install protobuf | ||||||||||
brew install protobuf-c | ||||||||||
|
||||||||||
However, this may require some editing of the driver makefiles. Specifically | ||||||||||
the include and linking flags, as homebrew will place relevant files and | ||||||||||
libraries in different locations to the installation from source method | ||||||||||
outlined above. The makefiles are written with the installation from source | ||||||||||
setup in mind. | ||||||||||
|
||||||||||
Getting Started | ||||||||||
--------------- | ||||||||||
|
||||||||||
The files for compilation and installation are found in the | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't give a suggestion on the wording below, but maybe move "In order to compile the driver simply run the makefile recipe." before you state "You should be able to simply run the shell script" so someone can just follow the flow in order. Also good to have a clear set of commands: cd domehunter/protos/
make
sh TheSkyX_plugin_install.sh |
||||||||||
``domehunter/protos/`` directory. The relevant files are, | ||||||||||
|
@@ -61,13 +103,25 @@ The files for compilation and installation are found in the | |||||||||
* ``Makefile`` | ||||||||||
|
||||||||||
The first two are files are used to install the compiled c++ | ||||||||||
driver. You should be able to simply run the shell script once | ||||||||||
the driver is compiled and located in the ``domehunter/protos/`` | ||||||||||
directory, with filename ``libHuntsmanDome.so``. | ||||||||||
driver into TheSkyX application directory. You should be | ||||||||||
able to simply run the shell script once the driver is compiled | ||||||||||
and located in the ``domehunter/protos/`` directory, with | ||||||||||
filename ``libHuntsmanDome.so``. | ||||||||||
|
||||||||||
| | ||||||||||
In order to compile the driver simply run the makefile recipe. | ||||||||||
In order to compile the driver simply run the makefile recipe for your OS (LINUX/MAC):: | ||||||||||
|
||||||||||
cd domehunter/protos/ | ||||||||||
make -f Makefile_LINUX | ||||||||||
|
||||||||||
This will produce a .so file in the protos directory for Linux and a .dylib file for Mac. | ||||||||||
This file, as well as the ``domelistHuntsmanDome.txt`` file need to be copied into TheSkyX | ||||||||||
application directory. This can be done by running the installation script:: | ||||||||||
|
||||||||||
. TheSkyX_LINUX_plugin_install.sh | ||||||||||
|
||||||||||
Replace `LINUX` with `MAC` if installing on a MacOS system and vice versa. | ||||||||||
|
||||||||||
| | ||||||||||
|
@@ -88,10 +142,50 @@ scripts. These can be used to generate the gRPC files within the ``src/`` | |||||||||
directory. These scripts contain path variables that may need to be | ||||||||||
adjusted to your local machine. You shouldn't need to worry about | ||||||||||
this as the generated files are committed to the repositry and | ||||||||||
shouldn't need to be generated. | ||||||||||
shouldn't need to be generated (I think...?). | ||||||||||
|
||||||||||
The code for the Huntsman dome driver is contained in the | ||||||||||
``domehunter/protos/src`` directory. This directory contains both | ||||||||||
human written files and files automatically generated by gRPC | ||||||||||
tools. The human written files are, | ||||||||||
|
||||||||||
* ``main.cpp`` - establishes main library to X2 driver (mostly copy/paste from example) | ||||||||||
* ``main.h`` - header for main.cpp | ||||||||||
* ``x2dome.cpp`` - the library code that serves the RPC from TSX to python server | ||||||||||
* ``x2dome.h`` - header for x2dome.cpp | ||||||||||
* ``hx2dome.proto`` - language agnostic RPC definitions used by everthing | ||||||||||
* ``hx2dome.proto_server.py`` - python server that receives RPC from TSX | ||||||||||
|
||||||||||
The remaining cpp and python files are automatically produced | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be moved somewhere else? It references its own section. |
||||||||||
by gRPC and shouldn't need to be looked at. If for some reason | ||||||||||
you want to generate these files yourself, see the | ||||||||||
*gRPC automatically generated files* section below. | ||||||||||
|
||||||||||
|
||||||||||
Python RaspberryPi Component | ||||||||||
============================ | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
Requirements | ||||||||||
--------------- | ||||||||||
Required: | ||||||||||
|
||||||||||
* ``gpiozero`` python library | ||||||||||
|
||||||||||
Optional: | ||||||||||
|
||||||||||
* ``smbus`` and ``sn3218`` python libraries | ||||||||||
|
||||||||||
Note: | ||||||||||
|
||||||||||
The ``smbus`` and ``sn3218`` are used to control the automationHAT status | ||||||||||
LEDs. If you plan on running the code without the automationHAT these libraries | ||||||||||
aren't required. | ||||||||||
|
||||||||||
Getting Started | ||||||||||
--------------- | ||||||||||
Follow the example jupyter notebook in the examples direction | ||||||||||
(``dome_control_example``). The automationHAT hardware is not required to run the | ||||||||||
code in testing mode. | ||||||||||
|
||||||||||
|
||||||||||
License | ||||||||||
|
@@ -102,8 +196,3 @@ the terms of the BSD 3-Clause license. This package is based upon | |||||||||
the `Astropy package template <https://github.com/astropy/package-template>`_ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe strip out the Astropy stuff in the readme (including the Astropy badge at top), unless you're really using it? |
||||||||||
which is licensed under the BSD 3-clause licence. See the licenses folder for | ||||||||||
more information. | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.