Skip to content

Commit

Permalink
More shell script and makefile hacking.
Browse files Browse the repository at this point in the history
  • Loading branch information
waynegramlich committed Mar 24, 2020
1 parent e600db1 commit 63f20f2
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 281 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.PHONY: all clean everything

SUB_DIRECTORIES := \
electrical \
mechanical

all:
for d in ${SUB_DIRECTORIES} ; do (cd $$d ; $(MAKE) all) ; done

clean:
for d in ${SUB_DIRECTORIES} ; do (cd $$d ; $(MAKE) clean); done

everything:
for d in $(SUB_DIRECTORIES) ; do (cd $$d ; $(MAKE) everything) ; done
211 changes: 97 additions & 114 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,28 @@
The HBRC ROS Robot platform (ie. HR<Sup>2</Sup> or just plain HR2) is a
pedagogical robotic platform developed for teaching various robotics skills.

## Installation/Download
This top level document is broken into the following sections below:

The installation/download directions are located in the last section of
this document below.
* [Google Group](#google-group):
The Google Group mailing list for this project.

* [Goals/Requirements](#goalsrequirements):
The goals and requirements for the project.

* [Mechanical](#mechanical):
The mechanical engineering aspects of the project.

* [Electrical](#electrical):
The electrical engineering aspects of the project.

* [Software](#software):
The software engineering aspects of the project.

* [Education](#education):
The education components of the pproject.

* [Download/Installation](#downloadinstallation):
The download and installation portions of the project.

## Google Group

Expand All @@ -31,6 +49,7 @@ front of the each subject line:
* `SE:` A message to people interested in the HR2 Software Engineering
(i.e. programs, firmware, etc.)
* `ED:` A message to people interested in the HR2 course materials.
* `DL:` A message concerning downloading and installation.
* `MSC:` A miscellaneous message that does not really fit any of the above
protocols.

Expand Down Expand Up @@ -81,75 +100,7 @@ made so far.
* Misc:
* What issues are missing?

## Installation and Directory Structure

Installing all software is a bit involved for the moment. The directions below
are Linux Ubuntu and Python centric. Later on, we can make the instructions
more inclusive, but for now Ubuntu is a requirement.

Start by install `git`:

sudo apt install git

In general, everything is organized a bunch of `git` repositories.
Please create a git root repositories directory, called `repos` below.
Now you can start to clone git repositories to the sub-directories
under the `repos` directory.

cd SOMEWHERE...
mkdir repos # You can choose a different name
cd repos
git clone https://github.com/hbrobotics/hbrc_ros_robot_platform.git
git clone https://github.com/waynegramlich/kicube32.git
git clone https://github.com/waynegramlich/bom_manager.git

There will probably be more repositories cloned in the future. The
three repositories above are:

* `hbrc_ros_robot_platform`:
This is primary repostory where most the HR2 materials reside.

* `kicube32`:
A program for using a microcontroller configuration tool and
and generating an associated KiCad schematic symbol.

* `bom_manager`:
This is a Bill Of Material manager used for ordering parts. (It is
currently broken.)

Next, there is a bunch of Python code. Python code has its own form of
platform neutral packaging. Due to a bunch of versioning issues, it is
best to install a system called Python Virtual Environments to run this
Python code in. Again, there are multiple ways to get Python virtual
environments set up. There is a nice
[virtual environments primer](https://realpython.com/python-virtual-environments-a-primer/)
on the subject. Please go the middle of the primer and follow the instructions
for installing `virtualenvwrapper`.

sudo apt get python
pip install virtualenvwrapper # You may need to say pip3 insead of pip
Add the following to your `~/.bashrc` file:

export WORKON_HOME=$HOME/.virtualenvs # Optional, but recommened
export PROJECT_HOME=$HOME/projects # Optional, but recommentd
source `which virtualenvwrapper.sh`

Source your `~/.bashrc` file:

source ~/.bashrc

Now now we create three virtual environmens, one for each repository:

cd repos
(cd hbrc_ros_robot_platform; mkvirtualenv -p 3.6 -a `pwd` hr2)
(cd kicube32; mkvirtualenv -p 3.6 -a `pwd` kicube32)
(cd bom_manager; mkvirtualenv -p 3.6 -a `pwd` bom_manager)

Now you can look around in the various sub-directoriesof `hbrc_ros_robot_platform`
There three for now and more will be added as needed:a

### `mechanical`
### Mechanical

The mechanical issues are worked out in greater detail in the
[mechancial directory](mechanical/README.md).
Expand All @@ -173,17 +124,17 @@ A short summary of the mechanical design decisions to date are:
processor. All H-bridges, power management, to be put on one board.
* FPGA boards to be done with a a daughter board that plugs into Nucleo-144 board.

## `electrical`
## Electrical

The electrical issues are worked out in greater detail in the
[electrical directory](electrical/README.md).

Some comments on the electrical:
Some brief comments on the electrical aspects are:

* The design is to be done using KiCad, since KiadD is 100% free.
* It would be nice to be able to use a simple two layer PCB.
* It would be nice to be able to take power from a USB Power pack.
* It would be nice to support daughter boards for.
* It would be nice to support daughter boards for FPGA's.

The overall strategy is to prototype everything using the
[Bantum Labs PCB Milling Machine](https://www.bantamtools.com/)
Expand All @@ -192,7 +143,9 @@ constrained to only prototyping boards that are 4 inches by 5 inches.
Once the electronics are debugged and working, the PCB's will be
sent out to an appropriate PCB Manufacturing house.

### `software`
### Software

This section is pretty brief for the moment...

The software issues are worked out in greater detail in the
[software directory](software/README.md).
Expand Down Expand Up @@ -242,6 +195,8 @@ The software goals are:

## Educational Classes:

This section is more of a place holder for now...

The list of possible classes for HR2 platform are:

* Low level robot peripheral drivers.
Expand All @@ -266,14 +221,18 @@ The list of possible classes for HR2 platform are:
* Rapid PCB prototyping w/Bantum Labs
* etc.

## Installation/Download
## Download/Installation

For now, this system can only be installed on a Ubuntu based Linux distribution.
Over time, this restriction can be relaxed, but for now it is Ubuntu based only.
What this means is that if you are running Window, MacOS, or some non-Ubuntu flavor
of Linux (Red Hat, Mint, Arch, etc.) you will need to download some virtualization
software (like Oracle `virtualbox`), install a Ubuntu linux, and run from there.
Furthermore, this script has only been tested on Ubuntu 18.04. It should work
on other versions, but issues may crop up. As issues crop up, please send the issues
to the group mailing list so they can be fixed. Alternatively, use the `github.com`
pull request workflow.
on new versions (18.10, 19.04, 19.10 and probably the upcomeing 20.04), but issues
may crop up. As issues crop up, please send the issues to the group mailing list
so they can be fixed. Alternatively, fix the problems yourself use the `github.com`
pull request workflow and submit pull requests.

The software is generally deployed in three broad catagories:

Expand All @@ -283,7 +242,7 @@ The software is generally deployed in three broad catagories:
* Python `pip` packages: There is lots of Python 3 code sprinkled around this project
and a bunch of it is packaged up as Python packages that can be installed with
the Python `pip` program. (By the way, `pip` stands for `Pip Installs Packages`.)
There is heavy use of a technology called Python Virtual Environments
There is heavy use of a technology called Python Virtual Environments.

There will be a number of cloned git repositories and they need to reside as
separate sub-directories under one parent repository directory. (One parent
Expand All @@ -292,49 +251,73 @@ want -- `repos`, `projects`, `funstuff`, `sauron`, etc. For the directions
below we use `REPOS` for this parent directory name. Please substitute the
directory name you picked for `REPOS` in the directions below:

Step 1: The first step is to clone the `hbrc_ros_robot_platform` repository.
There are two ways of doing this -- a direct clone form `github.com` or an
indirect clone from `github.com`. Beginners should do the direct clone
instuctions immediately below and `github.com` experts should modify the
instructions below for the indirect clone. Let's get going:

cd .../REPOS # Change the current working directory to REPOS
# We need to get `git` installed. If it is already installed, skip the install below:
sudo apt get install git
# This will propably prompt for your root password, type in your root password.
# Now install the `hbrc_ros_robot_platform`:
git clone https://github.com/hbrobotics/hbrc_ros_robot_platform.git
There are 3 broad steps:

1. The first step is to clone the `hbrc_ros_robot_platform` repository.
There are two ways of doing this -- a direct clone form `github.com` or an
indirect clone from `github.com`. Beginners should do the direct clone
instuctions immediately below and `github.com` experts should modify the
instructions below for the indirect clone. Let's get going:

cd .../REPOS # Change the current working directory to REPOS
# We need to get `git` installed.
# If `git` is already installed, skip the install below:
sudo apt get install git
# Now "clone" the `hbrc_ros_robot_platform` repository using `git`:
# This will probably prompt for your root password...
# Type in your root password if when asked..
git clone https://github.com/hbrobotics/hbrc_ros_robot_platform.git
# Change the current working directory to the root of the cloned repository
cd hbrc_ros_robot_platform

Step 2: The second step is to run the `install.sh` shell script. This script installs
other ubuntu packages, edits your `~/.bashrc` file, installs other packages, etc.
This script uses `sudo apt get ...` to install packages. It may prompt for your
root password again. It tends to be chatty to let you know what it is doing.
The final step is to run the `make everything` command (see immediately below)
to finish everything off. Let's do the second step:
2. The second step is to run one or more installation scripts. There are currently
three scripts:

* `mechancical/install_me.sh`:
This script resides in the `mechanical` sub-directory and will install everything
needed for the mechanical aspects of the project:

./mechanical/install_me.sh # Install the mechanical portion of the project.

* `electrical/install_ee.sh`:
This script resides in the `electrical` sub-directory and will install everything
needed for the mechanical aspects of the project.

`./electrical/install_ee.sh # Install the electrical portion of this project.`

* `install_all.sh`:
This script just installs everything.

`./install.sh # Install everything.`
3. There are a bunch of `Makefile`'s sprinkled through out the various
sub directories in the project. The `make` program can recursively visit each
of these `Makefile`'s and do any additonal needed steps. There are two `make`
targets in all `Makefile`'s:

* `all`: This is the normal do day-to-day target that is used when you
simply type `make`.
* `everything`: This is meant to be used once since it does additional steps
that are rarely needed -- create images, `dxf` files, etc. This target
is triggered by typing `make everything`.

cd hbrc_ros_robot_platform
./install.sh # This triggers a great deal of stuff.
4. There are two things left to do:

Step 3: There are a bunch of `Makefile`'s sprinkled through out the various
sub directories in the project. The `make` program can recursively visit each
of these `Makefile`'s and do any additonal needed steps. There are two `make`
targets:
A. Enable your python virtual environment:

* `all`: This is the normal do day-to-day target.
* `everything`: This is meant to be used once since it does additional steps
that are rarely needed -- create images, `dxf` files, etc.
source ~/.bashrc # Prepare for python virtual environments
workon hr2 # Enable the hr2 virtual environment

For the first time through, we use the `everything` target:
B. Use the `make` program to recursively build `everything` by typing:

make `everything`
make everything

After that we tend to just type `make`, which will default to the `all` target.
For the first time through, we use the `everything` target:

With the conclusion of this last command all of the software and design files
should be installed and ready to go.
make `everything` # Force everything to be recursively made.

Installing is a notoriously fragile process and it is quite possible that
something can go wrong. If so, please send a message to the group list with
the `INST:` prefix on the subject line explaining the issue.
the `DL:` prefix on the subject line explaining the issue so it can be resolved.


12 changes: 8 additions & 4 deletions electrical/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
.PHONY: all
.PHONY: all clean everthinga

BOARD_DIRECTORIES = \
master_board/rev_a

all:
@for d in ${BOARD_DIRECTORIES} ; do \
(cd $$d ; make all) ; \
done
for d in ${BOARD_DIRECTORIES} ; do (cd $$d ; $(MAKE) all) ; done

everything:
for d in ${BOARD_DIRECTORIES} ; do (cd $$d ; $(MAKE) everything) ; done

clean:
for d in ${BOARD_DIRECTORIES} ; do (cd $$d ; $(MAKE) clean) ; done
Loading

0 comments on commit 63f20f2

Please sign in to comment.