For this work, first I loaded the RRBot in Gazebo and
launched Its joints controller, then I sent a periodic signal to the robot such that the laser scanner mounted on the robot swings.
In the following, I assembled the incoming laser scans with the transformation from tf and created PCL point cloud.
Install the necessary package:
1 |
sudo apt-get install ros-kinetic-laser-assembler ros-kinetic-laser-geometry ros-kinetic-rqt-controller-manager ros-kinetic-ros-controllers ros-kinetic-gazebo-ros ros-kinetic-gazebo-ros-control ros-kinetic-robot-state-publisher ros-kinetic-ros-comm ros-kinetic-gazebo-plugins |
get gazebo_ros_demos from gitHub
1 |
git clone https://github.com/ros-simulation/gazebo_ros_demos |
Add the path to ROS_PACKAGE_PATH
1 2 |
source /opt/ros/kinetic/setup.sh export ROS_PACKAGE_PATH=~/.softwares/gazebo_ros_demos/:$ROS_PACKAGE_PATH |
due to new updates, you need to make some changes in the file rrbot.gazebo, you have to add
this line <legacyModeNS>true</legacyModeNS>
1 2 3 4 5 6 7 8 |
<!-- ros_control plugin --> <gazebo> <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so"> <robotNamespace>/rrbot</robotNamespace> <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType> <strong><legacyModeNS>true</legacyModeNS></strong> </plugin> </gazebo> |
Now run the followings:
1 2 3 |
roslaunch rrbot_gazebo rrbot_world.launch roslaunch rrbot_control rrbot_control.launch |
you need to install some plugins for rqt. These plug ins will enable you send messages with rqt.
1 |
sudo apt-get install ros-kinetic-rqt-publisher ros-kinetic-rqt-common-plugins ros-kinetic-rqt-topic |
Now launch rqt_gui:
1 2 |
source /opt/ros/kinetic/setup.sh rosrun rqt_gui rqt_gui |
set the second joint value
(/rrbot/joint2_position_controller/command) into (pi/4)+(1*pi/4)*sin(i/40)*sin(i/40)
and the frequency into 50 Hz, and /rrbot/joint2_position_controller/command) into 0
Laser Assembler:
1 2 3 4 |
mkdir -p catkin_ws/src && cd catkin_ws/src git clone https://github.com/behnamasadi/laser_assembler source /opt/ros/kinetic/setup.sh cd ../ && catkin_make |
Finally, run:
1 2 |
cd /home/behnam/catkin_ws/devel/lib/laser_assembler ./laser_assembler_service_caller |
Create a launch file and save the following lines to it and save it under laser_assembler.launch
1 2 3 4 5 6 7 |
<launch> <node type="laser_scan_assembler" pkg="laser_assembler" name="my_assembler"> <remap from="scan" to="/rrbot/laser/scan"/> <param name="max_clouds" type="int" value="400" /> <param name="fixed_frame" type="string" value="world" /> </node> </launch> |
and run it with roslaunch:
1 |
roslaunch laser_assembler.launch |
you should get this :
1 |
rosrun rqt_graph rqt_graph |
source code at my git hub
Hi Mr. Asadi
I sent you an e mail about this code. would you mind if I could look at your mail?
Hi
when ı run rqt_gui rqt_gui ,does not show topic lists (rrbot/joint1…)with equations. Why ?
… [Trackback]
[…] Read More Infos here: ros-developer.com/2017/08/03/assembling-laser-scans-into-pcl-point-cloud-using-gazebo-and-ros/ […]