|
| 1 | +# Install tof-ros2 project on NXP camera with ToF |
| 2 | + |
| 3 | +First install an ubuntu image on a sdcard. |
| 4 | +You can take lastest ubuntu image with ToF project from url |
| 5 | + |
| 6 | +[https://github.com/analogdevicesinc/ToF/releases](https://github.com/analogdevicesinc/ToF/releases) |
| 7 | + |
| 8 | +After you login on NXP camera with ubuntu image connect camera |
| 9 | +on network and with usb cable to pc. |
| 10 | +[https://wiki.analog.com/eval-adtf3175-nxz-startup](https://wiki.analog.com/eval-adtf3175-nxz-startup) |
| 11 | + |
| 12 | +Update ToF build to latest release version. |
| 13 | +You can install ToF project from here. |
| 14 | +[https://github.com/analogdevicesinc/ToF/blob/main/doc/itof/linux_build_instructions.md](https://github.com/analogdevicesinc/ToF/blob/main/doc/itof/linux_build_instructions.md) |
| 15 | + |
| 16 | +Now you can install ros2 on nxp camera. |
| 17 | +The archive with source code of ros2 framework will be written here in this doc. |
| 18 | +It will be on an server and you can get ros2 archive with wget command. |
| 19 | + |
| 20 | +For building ros2 you need colcon build tool. |
| 21 | +You can install colcon from |
| 22 | +[https://colcon.readthedocs.io/en/released/user/installation.html](https://colcon.readthedocs.io/en/released/user/installation.html) |
| 23 | +For installing colcon you may install curl package and its dependency gnupg package |
| 24 | + |
| 25 | +After install colcon make a directory in home folder |
| 26 | + |
| 27 | +```console |
| 28 | + mkdir ros2_foxy |
| 29 | +``` |
| 30 | + |
| 31 | +Download the ros2 archive with the name scr in ros2_foxy folder. |
| 32 | + |
| 33 | +Extract the archive with the tar command |
| 34 | + |
| 35 | +You will have something like ~/ros2_foxy/src |
| 36 | + |
| 37 | +Now in src folder clone the tof-ros2 project |
| 38 | + |
| 39 | +```console |
| 40 | + git clone https://github.com/analogdevicesinc/tof-ros2.git |
| 41 | +``` |
| 42 | + |
| 43 | +Then install some ros2 library dependencies |
| 44 | + |
| 45 | +```console |
| 46 | + sudo apt-get install libasio-dev |
| 47 | + sudo apt install libtinyxml2-dev |
| 48 | + sudo apt-get install -y liblog4cxx-dev |
| 49 | + pip3 install lark |
| 50 | +``` |
| 51 | + |
| 52 | +Now cd in folder ~/ros2_foxy folder |
| 53 | + |
| 54 | +Build the tof-ros2 project and ros2 archive |
| 55 | + |
| 56 | +```console |
| 57 | + colcon build --packages-skip-build-finished --packages-up-to tof_ros2cpp |
| 58 | +``` |
| 59 | + |
| 60 | +This will install ros2 and tof-ros2 over 100 ros2 packages |
| 61 | +Wait for building the project about one , two hours. |
| 62 | + |
| 63 | +After install the tof-ros2 now you can run the node tof-ros2 |
| 64 | +To run the node you must install another package. |
| 65 | + |
| 66 | +```console |
| 67 | + colcon build --packages-skip-build-finished --packages-up-to ros2run |
| 68 | +``` |
| 69 | + |
| 70 | +For run the tof_ros2 project you must run before two commands source and export |
| 71 | +In folder ~/ros2_foxy you run the comands |
| 72 | + |
| 73 | +```console |
| 74 | + source install/local_setup.sh |
| 75 | +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH;/opt/websockets/lib;/usr/local/lib" |
| 76 | +``` |
| 77 | + |
| 78 | +Now you can run the node tof-ros2 |
| 79 | + |
| 80 | +```console |
| 81 | + ros2 run tof_ros2cpp tof_ros2cpp_node config_file=config/config_adsd3500_adsd3100.json mode=1 enable_multithread=true |
| 82 | +``` |
| 83 | + |
0 commit comments