-
I first downloaded the zip file given for the exercise 1 from the official website: https://rsl.ethz.ch/education-students/lectures/ros.html
-
I then extracted the zip file: smb_common into the git folder i made.
-
I followed this github repository for reference and teleop file. I needed this repo because there were may errors while I ran the launch file of the simulation as I had to install some plugins and the readme files given in the downloaded zip files were not good.
-
Then I created a workspace ' zurich ' with catkin build.
sudo apt-get install python3-catkin-tools
mkdir -p zurich/src
cd ~/zurich
catkin build
- Then I downloaded the required plugins/ dependencies
sudo apt install -y ros-<distro>-hector-gazebo-plugins \
ros-<distro>-velodyne \
ros-<distro>-velodyne-description \
ros-<distro>-velodyne-gazebo-plugins \
ros-<distro>-pointcloud-to-laserscan \
ros-<distro>-twist-mux
where <distro>
can be either melodic or noetic.
catkin build
- then I used symlink to link packages in my git folder to my workspace and built the package.
ln -s ~/git/smb_common/smb_gazebo/ ~/zurich/src/
catkin build smb_gazebo
similarly for other 2 packages
- Then I created another package ' exer1 ' and built it
- Then I made a folder scripts and made a file : 'teleop_twist_keyboard.py' and copied the code from the repo I mentioned. Then, I made it executable using
chmod +x teleop_twist_keyboard.py
Then, I added these lines in the CMake file of the package
catkin_install_python(PROGRAMS scripts/teleop_twist_keyboard.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
- I launched the simulation with
roslaunch smb_gazebo smb_gazebo.launch
- I ran the teleop node with
rosrun exer1 teleop_twist_keyboard.py
when u run the teleop file, you will have to make changes in it based on the name of the package in which u created it.
- download the zip file and move the package into the same workspace. Make scipts, config, launch folders in the smb_highlevel_controller package
- check the topic info /scan, based on that write a node to subscribe to scan topic, its sensor_msgs/LaserScan, so import it accordingly
- create a launch file to launch the above subscriber node
- then make a config.yaml file with the topic name and queue size in config folder
- load the parameter server using the launch file
- access the params using rospy.get_param()
-
check the msg type of laserscan and access the ranges and find min value accordingly
-
in rviz, using add option add the following with these params in Global Options, Fixed Frame : odom in PointCloud2, Topic: /rslidar_points, Size: 0.05 in LaserScan, Topic: /scan, Size: 0.05 add TF and RobotModel too
-
save the rviz configuration as default.rviz in a rviz folder inside the package
-
Now you can visualize the point clouds and the laser scan in rviz like this: RVIZ Gazebo
-
Now you can write a subscriber node which subscribes to the rslidar_points and prints the number of points and can launch it through another launch file
- You can launch a launch file from another launch file and pass arguments to it using the below code.(useful for big projects)
reading laserscan data https://www.theconstructsim.com/read-laserscan-data/
yaml fromat for rosparam https://roboticsbackend.com/ros-param-yaml-format/
saving a rviz configurationa and launching it through launch file https://www.theconstructsim.com/gazebo-in-5-minutes-010-how-to-launch-rviz-using-a-configuration-file/
showing laser data on rviz https://www.theconstructsim.com/ros-qa-122-how-to-show-laser-data-on-rviz/
launching a launch file from a launch file https://www.theconstructsim.com/ros-5-mins-017-include-launch-file-inside-launch-file/ https://answers.ros.org/question/199152/run-launch-file-with-arg-from-launch-file/ https://wiki.ros.org/roslaunch/XML/include