diff --git a/.gitignore b/.gitignore index 99193a0..c38f655 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,6 @@ devel/ carsimplesimulink/ AV-T_bag/ odometer/ -skynetmini/ subtractor/ src/AV-T_bag src/carsimplesimulink diff --git a/CMakeLists.txt b/CMakeLists.txt index b20cbfd..53d6854 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.9) -project(skynetmini_controller2) +project(skynetmini) set(CMAKE_VERBOSE_MAKEFILE ON) # Set CMAKE_BUILD_TYPE set(CMAKE_BUILD_TYPE Release) diff --git a/launch/skynetminihwil.launch b/launch/skynetminihwil.launch new file mode 100644 index 0000000..e536698 --- /dev/null +++ b/launch/skynetminihwil.launch @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libpanda-apps.yaml b/libpanda-apps.yaml new file mode 100644 index 0000000..59e160c --- /dev/null +++ b/libpanda-apps.yaml @@ -0,0 +1,20 @@ +apps: + - name: skynetmini + properties: + - owns_panda: true + dependencies: + - apt: python3-pandas + - pip3: cantools + - pip3: shapely + ros_repositories: + - owner: jmscslgroup + repo: can_to_ros + - owner: jmscslgroup + repo: cbf + branch_or_hash: original_CBF_implementation_2021 + - owner: jmscslgroup + repo: velocity_controller + - owner: jmscslgroup + repo: setpointreader + - owner: jmscslgroup + repo: skynetmini diff --git a/package.xml b/package.xml index 2833260..78ccb04 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ - skynetmini_controller2 + skynetmini 1.0.0 TODO ROS User diff --git a/skynetmini/description.txt b/skynetmini/description.txt new file mode 100644 index 0000000..23f8c1d --- /dev/null +++ b/skynetmini/description.txt @@ -0,0 +1 @@ +This project explores the potential of Adaptive Cruise Control (ACC) systems to enhance fuel efficiency in vehicles while ensuring effective and safe car-following behavior. diff --git a/skynetmini/install.sh b/skynetmini/install.sh new file mode 100644 index 0000000..7fd2fb4 --- /dev/null +++ b/skynetmini/install.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +echo "==========================" +echo "Installing App skynetmini" + +# Here is where we perform installation of scripts, services, etc. +echo " - Installing ROS packages for skynetmini..." + +LIBPANDA_SRC=$(cat /etc/libpanda.d/libpanda_src_dir) +LIBPANDA_USER=$(cat /etc/libpanda.d/libpanda_usr) +LAUNCH_FILE=skynetminihwil.launch + +source /home/$LIBPANDA_USER/.bashrc + +# if [ -d /home/$LIBPANDA_USER/strym ]; then +# pushd /home/$LIBPANDA_USER/strym +# git pull +# else +# pushd /home/$LIBPANDA_USER/ +# git clone https://github.com/jmscslgroup/strym +# fi +# popd + +runuser -l $LIBPANDA_USER -c /etc/libpanda.d/apps/skynetmini/installRosPackages.sh + +echo "Installing {APP_NAME_PRETTY}..." +# runuser -l $LIBPANDA_USER -c /etc/libpanda.d/apps/vsl/installMidVslController.sh +pushd /home/$LIBPANDA_USER/catkin_ws +runuser -l $LIBPANDA_USER -c 'source /opt/ros/noetic/setup.bash && cd catkin_ws && catkin_make' +source devel/setup.sh +rosrun robot_upstart install skynetmini/launch/${LAUNCH_FILE} --user root + +echo "Enabling can_to_ros startup script" +sudo systemctl daemon-reload +sudo systemctl enable skynetmini +popd +echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" diff --git a/skynetmini/installController.sh b/skynetmini/installController.sh new file mode 100644 index 0000000..ed70de1 --- /dev/null +++ b/skynetmini/installController.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Author: Matt Nice,Matt Bunting + +LAUNCH_FILE=skynetminihwil.launch + +echo "----------------------------" +if [[ $EUID == 0 ]]; + then echo "Do NOT run this script as root" + exit +fi + +source ~/.bashrc + +pushd ~/catkin_ws +source devel/setup.sh + +# rosrun robot_upstart install can_to_ros/launch/${LAUNCH_FILE} --user root +rosrun robot_upstart install ${LAUNCH_FILE} --user root + +echo "Enabling can_to_ros startup script" +sudo systemctl daemon-reload +sudo systemctl enable skynetmini +popd + +echo "----------------------------" diff --git a/skynetmini/installRosPackages.sh b/skynetmini/installRosPackages.sh new file mode 100644 index 0000000..5a21fda --- /dev/null +++ b/skynetmini/installRosPackages.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Author: Matt Bunting, Matt Nice + +echo "----------------------------" +if [[ $EUID == 0 ]]; + then echo "Do NOT run this script as root" + exit +fi + +echo "Installing/Updating {APP_NAME_PRETTY} packages" + +source ~/.bashrc + +LIBPANDA_SRC=$(cat /etc/libpanda.d/libpanda_src_dir) + + +cd ~ +if [ ! -d catkin_ws/src ]; then + mkdir -p catkin_ws/src +fi + +cd ~/catkin_ws +source /opt/ros/noetic/setup.bash + +echo "Regenerating CanToRos" +cd ~/catkin_ws/src/can_to_ros/scripts +echo y | ./regenerateCanToRos.sh + + +# Build: +source ~/catkin_ws/devel/setup.sh +cd ~/catkin_ws +catkin_make + + +echo "Enabling can_to_ros startup script" +sudo systemctl daemon-reload +sudo systemctl enable skynetmini + + + +echo "----------------------------" diff --git a/skynetmini/service b/skynetmini/service new file mode 100644 index 0000000..b3dab9e --- /dev/null +++ b/skynetmini/service @@ -0,0 +1 @@ +skynetmini diff --git a/skynetmini/start.sh b/skynetmini/start.sh new file mode 100644 index 0000000..93705ea --- /dev/null +++ b/skynetmini/start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +echo "==========================" +echo "Starting App skynetmini for {APP_NAME_PRETTY}" + + +systemctl start skynetmini +systemctl start rosnodeChecker diff --git a/skynetmini/stop.sh b/skynetmini/stop.sh new file mode 100644 index 0000000..9e01d61 --- /dev/null +++ b/skynetmini/stop.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "==========================" +echo "Stopping App skynetmini" + +systemctl stop rosnodeChecker +systemctl stop skynetmini diff --git a/skynetmini/uninstall.sh b/skynetmini/uninstall.sh new file mode 100644 index 0000000..63241b1 --- /dev/null +++ b/skynetmini/uninstall.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +echo "==========================" +echo "Removing App skynetmini" + + +LIBPANDA_USER=$(cat /etc/libpanda.d/libpanda_usr) + +# Disable the installed services: +echo " - Disabling startup scripts..." +systemctl disable skynetmini + + +# Here is where we remove scripts, services, etc. +echo " - Removing scripts..." +cd +if [ "x"`systemctl list-units | grep -c skynetmini.service` = "x1" ]; then + echo "Uninstalling skynetmini.service" + + source /home/$LIBPANDA_USER/catkin_ws/devel/setup.bash + rosrun robot_upstart uninstall skynetmini +fi + +systemctl daemon-reload # if needed