mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Fixing the frcsim installer script
URL for simulation zip changed as of gerrit 1264 script argument name changed from INSTALLER to INSTALL fixed jar and logo paths for sim_ds to use the script, it's now simply: ./frcsim-installer.sh INSTALL You can optionally supply a promotion status from which to install, such as ./frcsim-installer.sh INSTALL beta ./frcsim-installer.sh INSTALL development Also added some information to the README Also allow any type of file install-resources since it may contain libraries and jars Change-Id: Ie876a05c88d3d48b8592f1800959988ae66edd04
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -177,4 +177,7 @@ __pycache__
|
||||
package.xml
|
||||
|
||||
# Doxygen stuff
|
||||
NO
|
||||
NO
|
||||
|
||||
# Simulation folder stuff
|
||||
!simulation/install_resources/*
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
## Simulation Directory
|
||||
## Components and Location
|
||||
|
||||
Observe the following directory structure:
|
||||
|
||||
.
|
||||
|-- frc_gazebo_plugins (contains Gazebo Plugins)
|
||||
| |-- clock
|
||||
| |-- dc_motor
|
||||
| |-- encoder
|
||||
| |-- gyro
|
||||
| |-- plugins
|
||||
| |-- pneumatic_piston
|
||||
| |-- potentiometer
|
||||
| |-- rangefinder
|
||||
| |-- servo
|
||||
|
|
||||
|-- frcsim (launches gazebo with model/plugin paths on linux)
|
||||
|-- JavaGazebo (java library used by java simulation. Equivelant of the C++ gazebo_transport)
|
||||
|-- SimDS (linux driverstation)
|
||||
Simluation is a mix of wpilib and other components.
|
||||
The wpilib components are in their respective locations in the /wpilibc and /wpilibj directories.
|
||||
|
||||
The gazbeo plugins are currently built with CMake.
|
||||
Eventually they will be built with gradle.
|
||||
|
||||
All of this is delivered to students via a zip file.
|
||||
## Simulation delivery and installation
|
||||
|
||||
For 2016 FRCSim is only officially supported on Ubuntu 14.04 or greater.
|
||||
However it is possible on any platform that runs Gazebo.
|
||||
FRCSim is currently delivered via a zip file published by this project,
|
||||
and is available at first.wpi.edu/FRC/roborio/maven/PROMOTION_STATUS/edu/wpi/first/wpilib/simulation/simulation/1.0.0/simulation-1.0.0.zip
|
||||
where PROMOTION_STATUS is one of:
|
||||
- development (the latest commit merged into wpilib)
|
||||
- beta (used periodically before release)
|
||||
- release (used just before kick-off and possibly a few other times)
|
||||
- stable (used for old releases we want to keep around)
|
||||
|
||||
The zip contains most of the contents of ~/wpilib/simulation, such as C++ libraries, jars, and scripts
|
||||
|
||||
The exmple robot model files are seperate, and can be found under "file releases" on collabnet.
|
||||
|
||||
All together you need eclipse, gazebo, those two zips, g++ 4.9, java8, and a few other small packages.
|
||||
See the frcsim-installer script or the screensteps on manual install for all the nitty-gritty details
|
||||
|
||||
The frcsim-installer script is meant for quick and painless setup on Ubuntu 14.04, 15.04, or 15.10
|
||||
A manual install is a more tedious process, so this is an easy option for students.
|
||||
|
||||
## Building
|
||||
See the top level README.md.
|
||||
|
||||
@@ -81,29 +81,49 @@ function check-environment {
|
||||
fi
|
||||
apt-get install unzip -y
|
||||
fi
|
||||
|
||||
# Make sure that app-apt-repository is installed
|
||||
if ! which add-apt-repository >/dev/null; then
|
||||
echo "*** You don't appear to have all apt commands installed." 1>&2
|
||||
echo "*** Install? (y/n)" 1>&2
|
||||
read CONT
|
||||
if [ "$CONT" != "y" -a "$CONT" != "Y" ]; then
|
||||
install-fail
|
||||
fi
|
||||
apt-get install software-properties-common -y
|
||||
fi
|
||||
}
|
||||
|
||||
function remove-frcsim {
|
||||
check-environment
|
||||
|
||||
echo "*** Remove Gazebo package entry too? (y/n)" 1>&2
|
||||
read CONT
|
||||
if [ "$CONT" == "y" -o "$CONT" == "Y" ]; then
|
||||
rm -f /etc/apt/sources.list.d/gazebo-latest.list
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get remove --auto-remove gazebo6 g++-4.9 openjdk-8-jdk
|
||||
apt-get remove --auto-remove libgazebo6-dev gazebo6 g++-4.9 openjdk-8-jdk
|
||||
rm -rf /opt/eclipse
|
||||
rm -f /usr/share/applications/frcsim.desktop /usr/share/applications/eclipse.desktop /usr/share/applications/sim_ds.desktop
|
||||
rm -f /usr/bin/frcism /usr/bin/sim_ds /usr/bin/eclipse
|
||||
rm -rf ~/wpilib/simulation
|
||||
|
||||
add-apt-repository --remove ppa:openjdk-r/ppa -y
|
||||
add-apt-repository --remove ppa:ubuntu-toolchain-r/test -y
|
||||
}
|
||||
|
||||
function install-eclipse-plugins {
|
||||
if ! (wget -O /tmp/simulation.zip http://first.wpi.edu/FRC/roborio/maven/development/simulation/simulation/1.0.0/simulation-1.0.0.zip)
|
||||
#valid URLs can have promotion status of any of the following
|
||||
# - development (used for most recent merge into wpilib)
|
||||
# - beta
|
||||
# - release
|
||||
# - stable
|
||||
|
||||
#this file is published to maven repo by simulation/build.gradle
|
||||
if ! (wget -O /tmp/simulation.zip http://first.wpi.edu/FRC/roborio/maven/$PROMOTION_STATUS/edu/wpi/first/wpilib/simulation/simulation/1.0.0/simulation-1.0.0.zip)
|
||||
then
|
||||
echo "***could not download wpilib simulation plugins, wrong URL probably***"
|
||||
echo "promotion status = $PROMOTION_STATUS"
|
||||
echo "url = http://first.wpi.edu/FRC/roborio/maven/$PROMOTION_STATUS/edu/wpi/first/wpilib/simulation/simulation/1.0.0/simulation-1.0.0.zip"
|
||||
install-fail
|
||||
fi
|
||||
|
||||
@@ -125,29 +145,65 @@ function install-eclipse {
|
||||
}
|
||||
|
||||
function install-desktops {
|
||||
# desktop files allow ubuntu (unity) users to "search" for their programs in the sidebar
|
||||
mv ~/wpilib/simulation/eclipse.desktop /usr/share/applications/eclipse.desktop
|
||||
mv ~/wpilib/simulation/frcsim.desktop /usr/share/applications/frcsim.desktop
|
||||
mv ~/wpilib/simulation/sim_ds.desktop /usr/share/applications/sim_ds.desktop
|
||||
mkdir -p /usr/share/icons/sim_ds
|
||||
mv ~/wpilib/simulation/sim_ds_logo.png /usr/share/icons/sim_ds/sim_ds_logo.png
|
||||
}
|
||||
|
||||
function install-gz_msgs {
|
||||
# gz_msgs is built on the end-user system
|
||||
# that way the versions of protobuf will match whatever the default for that platform is
|
||||
cd ~/wpilib/simulation/gz_msgs
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
make install
|
||||
chmod u+x ~/wpilib/simulation/lib/libgz_msgs.so
|
||||
}
|
||||
|
||||
function install-toolchain {
|
||||
add-apt-repository ppa:openjdk-r/ppa -y
|
||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
apt-get update
|
||||
# older version of ubuntu like 14.04 don't have the versions of g++ and java we need
|
||||
# we can add some very reliable PPAs to get them however
|
||||
if [[ "`lsb_release -rs`" == "14.04" ]]
|
||||
then
|
||||
echo "*** You're using `lsb_release -r`, you will need additional repositories***"
|
||||
echo "*** Install? (y/n)" 1>&2
|
||||
read CONT
|
||||
if [ "$CONT" != "y" -a "$CONT" != "Y" ]; then
|
||||
install-fail
|
||||
fi
|
||||
add-apt-repository ppa:openjdk-r/ppa -y
|
||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
fi
|
||||
if [[ "`lsb_release -rs`" == "15.04" ]]
|
||||
then
|
||||
echo "*** You're using `lsb_release -r`, you will need additional repositories***"
|
||||
echo "*** Install? (y/n)" 1>&2
|
||||
read CONT
|
||||
if [ "$CONT" != "y" -a "$CONT" != "Y" ]; then
|
||||
install-fail
|
||||
fi
|
||||
add-apt-repository ppa:openjdk-r/ppa -y
|
||||
fi
|
||||
|
||||
# Update and install dependencies
|
||||
if ! apt-get update
|
||||
then
|
||||
echo "*** Could not resynchronize package index files." 1>&2
|
||||
echo "*** Are you running another update or install?" 1>&2
|
||||
install-fail
|
||||
fi
|
||||
|
||||
apt-get install cmake libprotoc-dev libprotobuf-dev protobuf-compiler g++-4.9 openjdk-8-jdk -y
|
||||
ln -fs /usr/bin/g++-4.9 /usr/bin/g++
|
||||
}
|
||||
|
||||
function install-models {
|
||||
# this zip file is made by hand. A better option to add models is to use the gazebo repository
|
||||
if ! (wget -O /tmp/models.zip https://usfirst.collab.net/sf/frs/do/downloadFile/projects.wpilib/frs.simulation.frcsim_gazebo_models/frs1160?)
|
||||
then
|
||||
echo "*** failed to download models. Check your internet connection! ***"
|
||||
@@ -177,14 +233,9 @@ function install-frcsim {
|
||||
install-fail
|
||||
fi
|
||||
|
||||
# Update and install dependencies
|
||||
if ! apt-get update
|
||||
then
|
||||
echo "*** Could not resynchronize package index files." 1>&2
|
||||
echo "*** Are you running another update or install?" 1>&2
|
||||
install-fail
|
||||
fi
|
||||
if ! apt-get install -y gazebo6
|
||||
install-toolchain
|
||||
|
||||
if ! apt-get install -y libgazebo6-dev gazebo6
|
||||
then
|
||||
echo "*** Could not install frcsim packages. See above output for details." 1>&2
|
||||
echo "*** Are you running another update or install?" 1>&2
|
||||
@@ -192,37 +243,63 @@ function install-frcsim {
|
||||
fi
|
||||
|
||||
install-eclipse-plugins
|
||||
install-toolchain
|
||||
install-gz_msgs
|
||||
install-eclipse
|
||||
install-desktops
|
||||
install-models
|
||||
|
||||
sudo chown -R $USER:$USER ~/wpilib
|
||||
change-ownership
|
||||
|
||||
# Done
|
||||
echo "Installation Finished!!"
|
||||
}
|
||||
|
||||
if [ "$1" == "ROOT" ]
|
||||
function install-fail {
|
||||
echo "***INSTALLATION UNSUCCESSFUL***"
|
||||
echo "***Check the output about for anything that looks like errors***"
|
||||
echo "Please comment on the following to tutorial if you're unable to resolve your problem:"
|
||||
echo "https://wpilib.screenstepslive.com/s/4485/m/23353/l/478421-installing-frcsim-with-a-script-ubuntu"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function change-ownership {
|
||||
chown -R $NON_SUDO_USER:$NON_SUDO_USER ~/wpilib
|
||||
}
|
||||
|
||||
if [ "$1" == "INSTALL-ROOT" ]
|
||||
then
|
||||
|
||||
if [ -z "$2" ]
|
||||
then
|
||||
echo "*** Could not set user ~/wpilib ownership to empty user***"
|
||||
install-fail
|
||||
else
|
||||
NON_SUDO_USER="$2"
|
||||
fi
|
||||
|
||||
if [ -z "$3" ]
|
||||
then
|
||||
PROMOTION_STATUS="release"
|
||||
else
|
||||
PROMOTION_STATUS="$3"
|
||||
fi
|
||||
|
||||
install-frcsim
|
||||
elif [ "$1" == "INSTALLER" ]
|
||||
|
||||
elif [ "$1" == "INSTALL" ]
|
||||
then
|
||||
SUDO_ASKPASS=/usr/bin/ssh-askpass sudo bash -c "$0 ROOT"
|
||||
NON_SUDO_USER="$USER"
|
||||
PROMOTION_STATUS="$2"
|
||||
SUDO_ASKPASS=/usr/bin/ssh-askpass sudo bash -c "$0 INSTALL-ROOT $NON_SUDO_USER $PROMOTION_STATUS"
|
||||
elif [ "$1" == "REMOVE-ROOT" ]
|
||||
then
|
||||
remove-frcsim
|
||||
elif [ "$1" == "REMOVE" ]
|
||||
then
|
||||
SUDO_ASKPASS=/usr/bin/ssh-askpass sudo bash -c "$0 REMOVE-ROOT"
|
||||
NON_SUDO_USER="$USER"
|
||||
SUDO_ASKPASS=/usr/bin/ssh-askpass sudo bash -c "$0 REMOVE-ROOT $NON_SUDO_USER $PROMOTION_STATUS"
|
||||
else
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "***This script requires an argument!***"
|
||||
echo "***Run ./frcsim_installer.sh INSTALLER to install***"
|
||||
echo "***Other options are REMOVE, or any of the functions in the script"
|
||||
else
|
||||
$@
|
||||
fi
|
||||
echo "***This script requires an argument!***"
|
||||
echo "***Run ./frcsim_installer.sh INSTALL to install***"
|
||||
echo "***The other option is REMOVE"
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
export GAZEBO_PLUGIN_PATH="${GAZEBO_PLUGIN_PATH}:${HOME}/wpilib/simulation/plugins"
|
||||
export GAZEBO_MODEL_PATH="${GAZEBO_MODEL_PATH}:${HOME}/wpilib/simulation/models"
|
||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/wpilib/simulation/plugins:${HOME}/wpilib/simulation/lib"
|
||||
export GAZEBO_PLUGIN_PATH="${HOME}/wpilib/simulation/plugins:${GAZEBO_PLUGIN_PATH}"
|
||||
export GAZEBO_MODEL_PATH="${HOME}/wpilib/simulation/models:${GAZEBO_MODEL_PATH}"
|
||||
export LD_LIBRARY_PATH="${HOME}/wpilib/simulation/plugins:${HOME}/wpilib/simulation/lib:${LD_LIBRARY_PATH}"
|
||||
gazebo --verbose $@
|
||||
|
||||
BIN
simulation/install_resources/jar/jinput-2.0.5.jar
Normal file
BIN
simulation/install_resources/jar/jinput-2.0.5.jar
Normal file
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
java -Djava.library.path=/home/peter/wpilib/simulation/jar -jar /home/peter/wpilib/simulation/jar/SimDS-all.jar
|
||||
java -Djava.library.path=~/wpilib/simulation/jar -jar ~/wpilib/simulation/jar/SimDS-all.jar
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Name=Sim DS
|
||||
Keywords=frcsim,driverstation
|
||||
Exec=/usr/bin/sim_ds
|
||||
Icon=~/wpilib/simulation/sim_ds_logo.png
|
||||
Icon=/usr/share/icons/sim_ds/sim_ds_logo.png
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Terminal=false
|
||||
|
||||
Reference in New Issue
Block a user