Skip to content

naorwaiss/velocity-with-camera-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

the camera code is ready it bring the x,y,z at pixel and m



# job that i need to do::
need to make
code
1) function to stop the loop
2) need to gave some validation - if the drone is at some x,y (pixel and distance ) the drone need to move at some direction
3) at function main - need to check if the camera not work the drone land
6) need to trunsfer the save plot from the jetson to the linux
8) check if the data at the exel and in the python is the same ... add simple print
9) low pass filter

jetson --
1) check if the jetson is get the pyrealsense - the new one
2) install alot of dependasis - that run on the linux computer and i dont follow it
3) need to check if all the code run on the jetson

drone --

2) doing some pid configuration - auto tune



dynamic function ---
2) check the direction of the velocity - i think that have some problem witht he minus and plus (at te graph)
3) change the function that gave as the V value - the price function

----------------------------------------------------------------------------------------------------------------------




#how to download all the thing to the jestson and simple tasks :

# drone-camera-forproject

-----------------------------------------------step 1 -------------------------------------------------------------
# python3.9.12 installation


sudo apt update
sudo apt upgrade
sudo apt install wget
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev
wget https://www.python.org/ftp/python/3.9.12/Python-3.9.12.tgz

# python3.9.12 installation
tar -xf Python-3.9.12.tgz
cd Python-3.9.12
./configure --enable-optimizations
make -j4  # You can change the number after -j to match the number of CPU cores for faster compilation. (this take like 30 min)
sudo make altinstall

# after the installation finish - make the python as defount (python and python3)
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 1
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.9 1

alternativ - check if the instalation finish - python --version /python3 --version.



#fix pip problem
sudo apt update
sudo apt install python3.9-distutils --- this command do some problem , ignore the problem 
wget https://bootstrap.pypa.io/get-pip.py
sudo python3.9 get-pip.py
sudo python3.9 -m pip install --upgrade pip

------------------------------------------------------------------step 2------------------------------------------------

# install cmake

cmake --version  #check you defoult camke version - remmber it to 

sudo apt-get install libcurl4-openssl-dev
sudo apt-get install curl   ##install curl
mkdir ~/cmake-source
cd ~/cmake-source
curl -LO https://cmake.org/files/v3.27/cmake-3.27.4.tar.gz
tar -xzvf cmake-3.27.4.tar.gz

# build and inastall cmake

cd cmake-3.27.4
./bootstrap
make -j2  # You can change the number after -j to match the number of CPU cores for faster compilation. (the bootstrap and make take 30 - 60 min)
sudo make install


#check the version again
cmake --version


-------------------------------------------------------step 3 --------------------------------------------------------------------------

# intelrealsense
#now go to intelreal sense git downlad and take some source file to install the sdk
#from here:  https://github.com/IntelRealSense/librealsense/releases/
need to take the source file with zip variation

unzip librealsense-2.48.0.zip -d /home/drone/naorp/cam

#got to this cd 
https://stackoverflow.com/questions/62134563/how-to-give-permission-to-intel-realsense-camera-on-ubuntu
mkdir build
cd build
sudo apt-get install libxinerama-dev
sudo apt-get install libxcursor-dev
#run this line to use the cmake
cmake ../ -DFORCE_RSUSB_BACKEND=ON -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/local/bin/python3.9 -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true -DBUILD_WITH_CUDA:bool=false

# installation
make -j2
sudo make install

# bashrc
vim ~/.bashrc
#use i to insert data
#to exit use esc and then :wq

#put this at bashrc - mabey need to fix it - lets see what at my jetson but

export PATH=$PATH:/usr/local/bin
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.9/site-packages
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.9
export PYTHONPATH=$PYTHONPATH:/home/drone/naorp/cam/librealsense-2.48.0/build/wrappers/python

#after exit
source ~/.bashrc


-----------------------------------------------------------------------step 4------------------------------------------------

need to do this aldo to get udev bitch
and check the camera frimware 
https://stackoverflow.com/questions/62134563/how-to-give-permission-to-intel-realsense-camera-on-ubuntu

#lets start 
clone https://github.com/IntelRealSense/librealsense
#cd to the clone 
cd librealsense
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/

#run this 2 command to update the ne udev rule 
sudo udevadm control --reload-rules
sudo udevadm trigger


check the realsense-veiwer to cehck if you got ditect camera 


-----------------------------------------------------end of camera installation-------------------------------------------------
-----------------------------------------------------------drone installation --------------------------------------------------
--------------------------------------------------------------step 1 -----------------------------------------------------------
# mavlink instalation
#at this point we can install the mavproxy
#can see this here also https://www.youtube.com/watch?v=nIuoCYauW3s



sudo apt-get update
sudo apt-get install python-pip python3-pip
sudo apt-get install python3-dev python3-opencv python3-wxgtk4.0  python3-matplotlib python3-lxml libxml2-dev libxslt-dev
sudo pip install PyYAML mavproxy
sudo mavproxy.py --master=/dev/ttyTHS1
#at this point the mavproxy activate


#to get premition - need to fix it ask tal (not work to add it to the bashrc)
sudo chmod a+rw /dev/ttyTHS1
Sudo mavproxy.py –master=/dev/ttyTHS1


pip install mavsdk

---------------------------------------------------more installation --------------------------------------------------


instalation for the data:
pip install aiofiles

-----------------------------------------------------computer commander installation ---------------------------------
# run simulation
run drone simulation with gazibo
cd PX4-Autopilot/Tools/setup
./ubuntu.sh


cd ~/PX4-Autopilot
make px4_sitl gazebo #this make regular dji drone

--------------------------------------------------------------help and more --------------------------------------


#import problem- at the script need to import pymavlink as:import pyrealsense2.pyrealsense2 as rs (not every time )

#helps at the installation camera process
1)IntelRealSense/librealsense#12137 #me ask for help
2)IntelRealSense/librealsense#6964 (comment) #install intelrealsense
3) IntelRealSense/librealsense#6980 (comment) #update the cmake

# udev rule problem 
4) https://stackoverflow.com/questions/62134563/how-to-give-permission-to-intel-realsense-camera-on-ubuntu










-------------------------------------------------------
sudo apt-get install gz-garden
s

------------------------------------------------------
#make jsim simulator
make px4_sitl_default jmavsim

# to run at other console some debug feature
~/.local/lib/python3.10/site-packages/mavsdk/bin/mavsdk_server udp://:14540 (need to change the dev.....)
/home/drone/.local/lib/python3.9/site-packages/mavsdk/bin/mavsdk_server serial:///dev/ttyTHS1




About

the camera code and the drone code combine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages