Skip to content

Commit

Permalink
Adding files to run on car. This probably breaks some of your existin…
Browse files Browse the repository at this point in the history
…g stuff, and I needed to create a folder that yo uhave in your gitignore.
  • Loading branch information
sprinkjm committed Nov 19, 2024
1 parent fc894ca commit b7cbdc8
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ devel/
carsimplesimulink/
AV-T_bag/
odometer/
skynetmini/
subtractor/
src/AV-T_bag
src/carsimplesimulink
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
32 changes: 32 additions & 0 deletions launch/skynetminihwil.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Controller Launches. profproject control and CBF -->
<node pkg="skynetmini" type="skynetmini_controller2" name="skynetmini_controller2_node" output="screen">
<remap from="/cmd_accel" to="/cmd_accel_pre"/>
</node>
<!-- CBF params -->
<arg name="description" default="skynetmini_controller2"/>

<arg name="margin" default="30.0"/>
<arg name="use_margin" default="false"/>
<arg name="hwil" default="true"/>
<arg name="readonly" default="false"/>
<arg name="vsl_hwil_test" default="false"/>
<!-- CBF node -->
<node pkg="cbf" type="cbf" name="cbf" if="$(eval not readonly and hwil)">
</node>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- CAN_to_ROS launches, for vehicle interface, subs, rosbag record and safety_checks(?) -->
<node pkg="can_to_ros" type="vehicle_interface" name="vehicle_interface" output="screen" respawn="true" respawn_delay="2" />
<node pkg="can_to_ros" type ="subs" name="subs" output="screen" if="$(arg hwil)">
</node>
<include file="$(find can_to_ros)launch/safety_checks.launch" />
<!-- recording the ros bag -->
<node pkg="can_to_ros" type ="rosbag_record.sh" name="bashscript2" output="screen" args="$(arg description) $(arg hwil)" />

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->


</launch>
20 changes: 20 additions & 0 deletions libpanda-apps.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>skynetmini_controller2</name>
<name>skynetmini</name>
<version>1.0.0</version>
<description>TODO</description>
<maintainer email="[email protected]">ROS User</maintainer>
Expand Down
1 change: 1 addition & 0 deletions skynetmini/description.txt
Original file line number Diff line number Diff line change
@@ -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.
37 changes: 37 additions & 0 deletions skynetmini/install.sh
Original file line number Diff line number Diff line change
@@ -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 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
25 changes: 25 additions & 0 deletions skynetmini/installController.sh
Original file line number Diff line number Diff line change
@@ -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 "----------------------------"
42 changes: 42 additions & 0 deletions skynetmini/installRosPackages.sh
Original file line number Diff line number Diff line change
@@ -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 "----------------------------"
1 change: 1 addition & 0 deletions skynetmini/service
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
skynetmini
8 changes: 8 additions & 0 deletions skynetmini/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo "=========================="
echo "Starting App skynetmini for {APP_NAME_PRETTY}"


systemctl start skynetmini
systemctl start rosnodeChecker
7 changes: 7 additions & 0 deletions skynetmini/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "=========================="
echo "Stopping App skynetmini"

systemctl stop rosnodeChecker
systemctl stop skynetmini
24 changes: 24 additions & 0 deletions skynetmini/uninstall.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b7cbdc8

Please sign in to comment.