Hello, I am new to ROS and Ubuntu and recently I was also struggling to make the camera work for turtlebot3 waffle_pi.
For me, I followed this route and now the camera is working fine in SLAM, the topics are available and rqt_image_view also shows the live feed from the camera.
I am using Ubuntu 20.04 with ROS-noetic with a Turtlebot3 waffle_pi robot hosting a Raspberry Pi 4 2GB SBC.
The issue here is that the raspicam_node for noetic is difficult to set up as most methods require deleting the previous catkin_ws and building a new one. However, I followed the last method in this link text. I will sum it up for you:
First of all, make sure the camera is working using the raspistill command and the peripherals for the camera are enabled in raspi-config.
Test it as:
raspistill -v -o test.jpg
Clone the package from github in your catkin_ws/src folder:
cd catkin_ws/src
git clone https://github.com/UbiquityRobotics/raspicam_node
Install the libraries:
sudo apt install libraspberrypi-dev libraspberrypi0 libpigpiod-if-dev
Install some packages:
sudo apt install ros-noetic-compressed-image-transport ros-noetic-camera-info-manager ros-noetic-diagnostic-updater
Afterward, compile the catkin_ws and source:
cd ..
catkin_make
source devel/setup.bash
The next thing is running two launch files at the same time to visualize the camera input in SLAM.
First, run a roscore on the remote-PC:
roscore
Open a secure shell with a robot and launch raspicam_node:
roslaunch raspicam_node camerav2_1280x960.launch
Open another secure shell and bring up the robot:
roslaunch turtlebot3_bringup turtlebot3_robot.launch
Now in the remote PC:
roslaunch turtlebot3_slam turtlebot3_slam.launch
In the new terminal window:
rqt_image_view
The image from the camera would be visible in both Rviz (where SLAM is running) and the rqt_image_view window.
Also, if you do 'rostopic list' in remote-PC, you would be able to see the camera-related topic published by raspicam_node.
This method worked for me. I apologize for any typos or inconvenience.
Thank you,
Muhammad Umar Farooq
Originally posted by Muhammad Umar with karma: 36 on 2021-12-06
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by osilva on 2021-12-08:
Hi Muhammad nice complete answer. If you could format using 10101 for the code portions it will help with readability