Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get config.txt path for Bookworm & earlier versions #69

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 14 additions & 20 deletions Install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
#!/bin/sh
FIND_FILE="/boot/config.txt"

# modfiy_config() {
# modfiy config
# sudo sed -i "s/\(^camera_auto_detect=*\)/#\1/" /boot/config.txt
# sudo sed -i "s/\(^camera_auto_detect=1\)/#camera_auto_detect=0/" /boot/config.txt
# sudo bash -c 'echo camera_auto_detect=0 >> /boot/config.txt'
# sudo sed -i "s/\(^dtoverlay=*\)/#\1/" /boot/config.txt
# sudo bash -c 'echo dtoverlay=vc4-fkms-v3d >> /boot/config.txt'
# }
FIND_FILE=""
if [ -f "/boot/firmware/config.txt" ]; then # Bookworm
FIND_FILE="/boot/firmware/config.txt"
elif [ -f "/boot/config.txt" ]; then # Bullseye and earlier
FIND_FILE="/boot/config.txt"
fi

# if [ $(lsmod | grep -c arducam_pivariety) -ge 5 ]; then
# echo "Arducam tof camera driver already installed!"
# else
# wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
# chmod +x install_pivariety_pkgs.sh
# ./install_pivariety_pkgs.sh -p kernel_driver
# fi
if [ "$FIND_FILE" = "" ]; then
echo "No config.txt file found."
exit 1
fi

if [ `grep -c "camera_auto_detect=1" $FIND_FILE` -ne '0' ];then
sudo sed -i "s/\(^camera_auto_detect=1\)/camera_auto_detect=0/" /boot/config.txt
sudo sed -i "s/\(^camera_auto_detect=1\)/camera_auto_detect=0/" $FIND_FILE
fi
if [ `grep -c "camera_auto_detect=0" $FIND_FILE` -lt '1' ];then
sudo bash -c 'echo camera_auto_detect=0 >> /boot/config.txt'
sudo bash -c "echo camera_auto_detect=0 >> $FIND_FILE"
fi
if [ `grep -c "dtoverlay=arducam-pivariety,media-controller=0" $FIND_FILE` -lt '1' ];then
sudo bash -c 'echo dtoverlay=arducam-pivariety,media-controller=0 >> /boot/config.txt'
sudo bash -c "echo dtoverlay=arducam-pivariety,media-controller=0 >> $FIND_FILE"
fi

if [ $(dpkg -l | grep -c arducam-tof-sdk-dev) -lt 1 ]; then
Expand All @@ -52,4 +46,4 @@ case $USER_INPUT in
echo "The script settings will only take effect after restarting, please restart yourself later."
exit 1
;;
esac
esac
18 changes: 13 additions & 5 deletions Install_dependencies_python.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/bin/sh
FIND_FILE="/boot/config.txt"

if [ -f "/boot/firmware/config.txt" ]; then
FIND_FILE="/boot/firmware/config.txt"
elif [ -f "/boot/config.txt" ]; then
FIND_FILE="/boot/config.txt"
else
echo "No config.txt file found."
exit 1
fi

if [ `grep -c "camera_auto_detect=1" $FIND_FILE` -ne '0' ];then
sudo sed -i "s/\(^camera_auto_detect=1\)/camera_auto_detect=0/" /boot/config.txt
sudo sed -i "s/\(^camera_auto_detect=1\)/camera_auto_detect=0/" $FIND_FILE
fi
if [ `grep -c "camera_auto_detect=0" $FIND_FILE` -lt '1' ];then
sudo bash -c 'echo camera_auto_detect=0 >> /boot/config.txt'
sudo bash -c "echo camera_auto_detect=0 >> $FIND_FILE"
fi
if [ `grep -c "dtoverlay=arducam-pivariety,media-controller=0" $FIND_FILE` -lt '1' ];then
sudo bash -c 'echo dtoverlay=arducam-pivariety,media-controller=0 >> /boot/config.txt'
sudo bash -c "echo dtoverlay=arducam-pivariety,media-controller=0 >> $FIND_FILE"
fi

sudo apt update
Expand Down Expand Up @@ -36,4 +44,4 @@ case $USER_INPUT in
echo "The script settings will only take effect after restarting, please restart yourself later."
exit 1
;;
esac
esac
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
This project is a use example based on arducam's depth camera. It includes basic image rendering using opencv, displaying 3D point clouds using PCL, and publishing depth camera data through the ROS2 system.
The depth camera is the depth data obtained by calculating the phase difference based on the transmitted modulated pulse. The resolution of the camera is 240*180. Currently, it has two range modes: 2 meters and 4 meters. The measurement error is within 2 cm.
The depth camera supports CSI and USB two connection methods, and needs an additional 5V 2A current power supply for the camera.
### Run project on RassperyPi
### Run the example in the exmaple folder
### Run project on Raspberry Pi
### Run the example in the example folder
#### Install dependencies
> Run in the Arducam_tof_camera folder
```Shell
Expand All @@ -30,7 +30,7 @@ The depth camera supports CSI and USB two connection methods, and needs an addit
</s>

### 2.Configuration
You need to alter the camera configuration in your /boot/config.txt file.to add dtoverlay.
You need to alter the camera configuration in your /boot/firmware/config.txt file.to add dtoverlay.
```Shell
dtoverlay=arducam-pivariety,media-controller=0
```
Expand Down