I am following the tutorials at this link for GMapping SLAM.
I have created a new package called rosbot_slam with rospy and roscpp as dependencies using
catkin_create_pkg rosbot_slam rospy roscpp
I created launch directory and a launch file called slam.launch with the following code
<arg name="use_rosbot" default="true"/>
<arg name="use_gazebo" default="false"/>
<include if="$(arg use_gazebo)" file="$(find rosbot_gazebo)/launch/maze_world.launch"/>
<include if="$(arg use_gazebo)" file="$(find rosbot_gazebo)/launch/rosbot.launch"/>
<node if="$(arg use_rosbot)" pkg="rplidar_ros" type="rplidarNode" name="rplidar">
<param name="angle_compensate" type="bool" value="true"/>
</node>
<node if="$(arg use_rosbot)" pkg="tutorial_pkg" type="drive_controller_node" name="drive_controller"/>
<node pkg="tf" type="static_transform_publisher" name="laser_broadcaster" args="0 0 0 3.14 0 0 base_link laser_frame 100" />
<node pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" name="teleop_twist_keyboard" output="screen"/>
<node pkg="rviz" type="rviz" name="rviz"/>
<node pkg="gmapping" type="slam_gmapping" name="gmapping">
<param name="base_frame" value="base_link"/>
<param name="odom_frame" value="odom" />
<param name="delta" value="0.1" />
</node>
On compiling the workspace using
catkin_make
I run
roslaunch rosbot_slam slam.launch
Then following errors are generated
The rosbot lidar is working fine when I use
roslaunch rplidar_ros view_rplidar_a3.launch
The command rqt_graph shows following image
The tf frames are as follows
Please help me resolve this error
Hello Pradeep_BV,
For ROSbot PRO is required modification for launch file, in:
<node if="$(arg use_rosbot)" pkg="rplidar_ros" type="rplidarNode" name="rplidar">
<param name="angle_compensate" type="bool" value="true"/>
</node>
add lines:
<!--<param name="serial_baudrate" type="int" value="115200">--><!--model A2 (ROSbot 2.0) -->
<param name="serial_baudrate" type="int" value="256000"/><!-- model A3 (ROSbot 2.0 PRO) -->
Respective update is already published in the tutorial.
Regards,
Łukasz
Hello Lukasz,
I get the following error once I resolve the problem with serial baud rate
For frame [laser_frame]: No transform to fixed frame [map]. TF error: [Could not find a connection between ‘map’ and ‘laser_frame’ because they are not part of the same tree. Tf has two or more unconnected trees.]
The launch file publishes the necessary transform between base_link and laser , the TF tree screenshot is attached above can you please guide me through the error.
Hello Pradeep_BV,
Could you post here full output that you receive when running launch file?
This will be helpful for debugging the problem.
Regards,
Łukasz
Hello Lukasz,
I am attaching screen shot of my terminal which launches my slam
roslaunch rosbot_slam slam.launch
It works fine launching all required files
But in RViz the following error occurs
For frame [laser_frame]: No transform to fixed frame [map]. TF error: [Could not find a connection between ‘map’ and ‘laser_frame’ because they are not part of the same tree. Tf has two or more unconnected trees.]
running tf view frames results as follows
rousrun tf view_frames
evince frames.pdf
The error seems to be in tf broadcasting. Please suggest any correction
Hello Pradeep_BV,
Screenshot of terminal will not be enough. When you start launch file, there are lots of output containing all launched nodes, their parameters and other debug info. You can see it when you scroll up the terminal.
Please copy paste this output as text from the first line.
Regards,
Łukasz
Hello Lukasz,
here is the info you requested
roslaunch rosbot_slam slam.launch
… logging to /home/husarion/.ros/log/930e7572-a22a-11e9-a5d6-70f11c0553cc/roslaunch-husarion-UP-CHT01-5955.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://husarion-UP-CHT01:33551/
SUMMARY
PARAMETERS
- /gmapping/base_frame: base_link
- /gmapping/delta: 0.1
- /gmapping/odom_frame: odom
- /rosdistro: kinetic
- /rosversion: 1.12.14
- /rplidar/angle_compensate: True
- /rplidar/serial_baudrate: 256000
NODES
/
drive_controller (tutorial_pkg/drive_controller_node)
gmapping (gmapping/slam_gmapping)
laser_broadcaster (tf/static_transform_publisher)
rplidar (rplidar_ros/rplidarNode)
rviz (rviz/rviz)
teleop_twist_keyboard (teleop_twist_keyboard/teleop_twist_keyboard.py)
auto-starting new master
process[master]: started with pid [6039]
ROS_MASTER_URI=http://master:11311
setting /run_id to 930e7572-a22a-11e9-a5d6-70f11c0553cc
process[rosout-1]: started with pid [6085]
started core service [/rosout]
process[rplidar-2]: started with pid [6103]
process[drive_controller-3]: started with pid [6107]
process[laser_broadcaster-4]: started with pid [6113]
process[teleop_twist_keyboard-5]: started with pid [6121]
process[rviz-6]: started with pid [6136]
process[gmapping-7]: started with pid [6151]
Reading from the keyboard and Publishing to Twist!
Moving around:
u i o
j k l
m , .
For Holonomic mode (strafing), hold down the shift key:
U I O
J K L
M < >
t : up (+z)
b : down (-z)
anything else : stop
q/z : increase/decrease max speeds by 10%
w/x : increase/decrease only linear speed by 10%
e/c : increase/decrease only angular speed by 10%
CTRL-C to quit
currently: speed 0.5 turn 1.0
Hello Pradeep_BV,
The tf between odom
and base_link
frames should be broadcasted by serial node
.
Please, post here output of:
rosnode info /serial_node
Regards,
Łukasz
Hello Lukasz,
The output is as follows
rosnode info /serial_node
Node [/serial_node]
Publications: None
Subscriptions: None
Services: None
cannot contact [/serial_node]: unknown node
Hello Pradeep_BV,
Serial node seems to be inactive, did you start serial bridge?
/opt/husarion/tools/rpi-linux/ros-core2-client /dev/ttyCORE2
Regards,
Łuaksz
Hello Lukasz,
Yes the serial node is active and functioning.
The screnshot of the serial node.
/opt/husarion/tools/rpi-linux/ros-core2-client /dev/ttyCORE2
[INFO] [1562665458.578513]: ROS Serial Python Node
[INFO] [1562665458.597998]: Connecting to /dev/ttyCORE2 at 500000 baud
[INFO] [1562665458.599157]: Iffff
[INFO] [1562665460.778644]: Note: publish buffer size is 512 bytes
[INFO] [1562665460.780743]: Setup publisher on /battery [sensor_msgs/BatteryState]
[INFO] [1562665460.794995]: Note: subscribe buffer size is 512 bytes
[INFO] [1562665460.796375]: Setup subscriber on /cmd_vel [geometry_msgs/Twist]
[INFO] [1562665460.811270]: Setup subscriber on /reset_odom [std_m
Hello Pradeep_BV,
Your controller is flashed with version from Tutorial 3 - part Converting motion command to motor drive signal.
It should be flashed with version from Tutorial 3 - Determining robot position.
It will publish and subscribe more topics:
[INFO] [1562665978.151560]: ROS Serial Python Node
[INFO] [1562665978.192639]: Connecting to /dev/ttyCORE2 at 500000 baud
[INFO] [1562665980.369408]: Note: publish buffer size is 512 bytes
[INFO] [1562665980.370698]: Setup publisher on /battery [sensor_msgs/BatteryState]
[INFO] [1562665980.378281]: Setup publisher on /pose [geometry_msgs/PoseStamped]
[INFO] [1562665980.386349]: Setup publisher on /joint_states [sensor_msgs/JointState]
[INFO] [1562665981.165689]: Setup publisher on /tf [tf/tfMessage]
[INFO] [1562665981.174090]: Note: subscribe buffer size is 512 bytes
[INFO] [1562665981.175094]: Setup subscriber on /cmd_vel [geometry_msgs/Twist]
[INFO] [1562665981.183273]: Setup subscriber on /reset_odom [std_msgs/Bool]
Regards,
Łukasz
Hello Lukasz,
The Gmapping works fine now.
Here is the map, the rosbot created
Thank you for the timely help