Skip to content

Commit

Permalink
merged master to branch
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniParr committed Sep 18, 2024
2 parents 6f96b0e + 408cf57 commit c63b165
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Install BlueView Sonar SDK
run: |
cd $GITHUB_WORKSPACE/catkin_ws/src/mil
./scripts/hardware_installers/install_bvtsdk --pass ${{ secrets.ZOBELISK_PASSWORD }}
./scripts/hw/install_bvtsdk --pass ${{ secrets.ZOBELISK_PASSWORD }}
ls mil_common/drivers/mil_blueview_driver
echo $PWD
- name: Install system dependencies
Expand Down
1 change: 1 addition & 0 deletions mil_common/mil_missions/nodes/mission_client
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MissionClientCli:
)
return
print("Available Missions:")
missions.sort()
for mission in missions:
print("- ", mission)

Expand Down
58 changes: 58 additions & 0 deletions scripts/hw/install_8bitdoo_udev
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

# 8bitdoo Ultimate Wireless Controller installation script, by Robert Michael Smith
# Original source: https://gist.github.com/loopyd/a7ccbf37e27580ccbed859c26aa0a167

# Block script from running as non-root user
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
# Blacklist Nintendo Switch Pro Controller Driver
echo blacklist hid_nintendo | tee /etc/modprobe.d/notendo.conf

# Install xboxdrv
apt-get update
if ! dpkg -s 'xboxdrv' &>/dev/null; then
apt-get install -y xboxdrv
fi

# Create udev rules
if [ ! -f '/etc/udev/rules.d' ]; then
mkdir -p '/etc/udev/rules.d'
fi
udev_rules='/etc/udev/rules.d/99-8bitdo-ultimate.rules'
if [ -f $udev_rules ]; then
sudo rm $udev_rules
fi
echo 'SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3106", ATTR{manufacturer}=="8BitDo", RUN+="/bin/systemctl start 8bitdo-ultimate-xinput@2dc8:3106"' | tee $udev_rules
echo 'SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3109", ATTR{manufacturer}=="8BitDo", RUN+="/bin/systemctl stop 8bitdo-ultimate-xinput@2dc8:3106"' | tee -a $udev_rules

# Reload udev rules
udevadm control --reload-rules
udevadm trigger

# Create systemd service
service_file='/etc/systemd/system/8bitdo-ultimate-xinput@.service'
if [ -f $service_file ]; then
rm $service_file
fi
echo '[Unit]' | tee $service_file
echo 'Description=8BitDo Ultimate Controller XInput mode xboxdrv daemon' | tee -a $service_file
echo '' | tee -a $service_file
echo '[Service]' | tee -a $service_file
echo 'Type=simple' | tee -a $service_file
echo 'ExecStart=/usr/bin/xboxdrv --mimic-xpad --silent --type xbox360 --device-by-id %i --force-feedback --detach-kernel-driver' | tee -a $service_file

systemctl daemon-reload

# Now install jstest-gtk to test the controller, which also installs all the joystick dependencies
# This fixes:
# - /dev/input/js0 not found
if ! dpkg -s 'jstest-gtk' &>/dev/null; then
apt-get install -y jstest-gtk
fi

# Now open jstest-gtk and test the controller, remap the axis / buttons, then exit
# Save the configuration using the command:
# sudo jscal-store /dev/input/js0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions scripts/setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,51 @@ dmb() {
git diff "$(git merge-base --fork-point "$(git branch -l main master --format '%(refname:short)')" HEAD)"
}

subnet_ip() {
ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){2}37\.[0-9]*' | grep -v '127.0.0.1'
}

rosdisconnect() {
unset ROS_IP
unset ROS_MASTER_URI
echo "Disconnected! New values:"
echo "ROS_IP=$ROS_IP"
echo "ROS_MASTER_URI=$ROS_MASTER_URI"
}

rosconnect() {
# --no-subnet flag to avoid checking for the subnet
# Usage: rosconnect --no-subnet <my_ip> <master_ip>
if [[ $1 == "--no-subnet" ]]; then
if [[ -z $2 || -z $3 ]]; then
echo "Usage: rosconnect --no-subnet <my_ip> <master_ip>"
return
fi
export ROS_IP=${2}
export ROS_MASTER_URI="http://${3}:11311"
echo "ROS_IP=$ROS_IP"
echo "ROS_MASTER_URI=$ROS_MASTER_URI"
return
fi
if [[ -n $(subnet_ip) ]]; then
my_ip=$(subnet_ip)
export ROS_IP=$my_ip
export ROS_MASTER_URI="http://${1}:11311"
echo "ROS_IP=$ROS_IP"
echo "ROS_MASTER_URI=$ROS_MASTER_URI"
else
echo "No 37 subnet IP found, not setting ROS_IP or ROS_MASTER_URI"
fi
}

rosnavconnect() {
rosconnect "192.168.37.82"
}

rossubconnect() {
rosconnect "192.168.37.60"
}

alias xbox=startxbox

# PYTHONPATH modifications
Expand Down

0 comments on commit c63b165

Please sign in to comment.