Difference between revisions of "Jetbot ROS"
From ESS-WIKI
(→Install ROS) |
|||
Line 26: | Line 26: | ||
Close and restart the terminal. | Close and restart the terminal. | ||
− | ''' Install python ''' | + | ''' Install python and adafruit libraries ''' |
<pre># pip should be installed | <pre># pip should be installed | ||
$ sudo apt-get install python-pip | $ sudo apt-get install python-pip | ||
+ | |||
# install Adafruit libraries | # install Adafruit libraries | ||
$ pip install Adafruit-MotorHAT | $ pip install Adafruit-MotorHAT | ||
Line 42: | Line 43: | ||
''' Create the catkin workspace ''' | ''' Create the catkin workspace ''' | ||
− | <pre> | + | Create a ROS Catkin workspace to contain our ROS packages. |
− | mkdir -p ~/workspace/catkin_ws/src | + | |
− | cd ~/workspace/catkin_ws | + | <pre># create the catkin workspace |
− | catkin_make | + | $ mkdir -p ~/workspace/catkin_ws/src |
+ | $ cd ~/workspace/catkin_ws | ||
+ | $ catkin_make | ||
# add catkin_ws path to bashrc | # add catkin_ws path to bashrc | ||
− | sudo sh -c 'echo "source ~/workspace/catkin_ws/devel/setup.bash" >> ~/.bashrc' | + | $ sudo sh -c 'echo "source ~/workspace/catkin_ws/devel/setup.bash" >> ~/.bashrc' |
+ | </pre> | ||
+ | |||
+ | Close and open a new terminal window. Verify that your catkin_ws is visible to ROS. | ||
+ | |||
+ | <pre>$ echo $ROS_PACKAGE_PATH | ||
+ | /home/nvidia/workspace/catkin_ws/src:/opt/ros/melodic/share | ||
</pre> | </pre> | ||
''' Install Jetbot_ros ''' | ''' Install Jetbot_ros ''' | ||
+ | |||
+ | Clone and build the jetbot_ros repo. | ||
<pre># git and cmake should be installed | <pre># git and cmake should be installed | ||
− | sudo apt-get install git cmake | + | $ sudo apt-get install git cmake |
+ | |||
# clone the repo | # clone the repo | ||
− | cd ~/workspace/catkin_ws/src | + | $ cd ~/workspace/catkin_ws/src |
− | git clone https://github.com/waveshare/jetbot_ros | + | $ git clone https://github.com/waveshare/jetbot_ros |
# build the package | # build the package | ||
− | cd ../ # cd ~/workspace/catkin_ws | + | $ cd ../ # cd ~/workspace/catkin_ws |
− | catkin_make | + | $ catkin_make |
# confirm that jetbot_ros package can be found | # confirm that jetbot_ros package can be found | ||
− | rospack find jetbot_ros | + | $ rospack find jetbot_ros |
/home/nvidia/workspace/catkin_ws/src/jetbot_ros | /home/nvidia/workspace/catkin_ws/src/jetbot_ros | ||
</pre> | </pre> |
Revision as of 02:57, 23 November 2022
Linux Version
jetson-nx-jp451-sd-card-image
Install ROS
Install ROS melodic
# enable all Ubuntu packages: $ sudo apt-add-repository universe $ sudo apt-add-repository multiverse $ sudo apt-add-repository restricted # add ROS repository to apt sources $ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' $ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 # install ROS Base $ sudo apt-get update $ sudo apt-get install ros-melodic-ros-base # add ROS paths to environment $ sudo sh -c 'echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc'
Close and restart the terminal.
Install python and adafruit libraries
# pip should be installed $ sudo apt-get install python-pip # install Adafruit libraries $ pip install Adafruit-MotorHAT $ pip install Adafruit-SSD1306
Add i2c too user
$ sudo usermod -aG i2c $USER
Create the catkin workspace
Create a ROS Catkin workspace to contain our ROS packages.
# create the catkin workspace $ mkdir -p ~/workspace/catkin_ws/src $ cd ~/workspace/catkin_ws $ catkin_make # add catkin_ws path to bashrc $ sudo sh -c 'echo "source ~/workspace/catkin_ws/devel/setup.bash" >> ~/.bashrc'
Close and open a new terminal window. Verify that your catkin_ws is visible to ROS.
$ echo $ROS_PACKAGE_PATH /home/nvidia/workspace/catkin_ws/src:/opt/ros/melodic/share
Install Jetbot_ros
Clone and build the jetbot_ros repo.
# git and cmake should be installed $ sudo apt-get install git cmake # clone the repo $ cd ~/workspace/catkin_ws/src $ git clone https://github.com/waveshare/jetbot_ros # build the package $ cd ../ # cd ~/workspace/catkin_ws $ catkin_make # confirm that jetbot_ros package can be found $ rospack find jetbot_ros /home/nvidia/workspace/catkin_ws/src/jetbot_ros
Test Jetbot_ros
$ roscore
Roscore |
$ rosrun jetbot_ros jetbot_motors.py $ rosnode list $ rostopic list
Rosnode list |