Hello,
I am doing SLAM using HUSKY A200, (ros1 kinetic on both end - robot and remote pc). I am using hector mapping for my mapping. I want to do SLAM without saving the map, just by using the 2D Nav goal in the rviz. I am using husky's move_base for that purpose. I am using a pepperl_fuchs_r2000 laser scanner.
My ROS master is set to in my remote pc .bashrc as:
export ROS_MASTER_URI=http://cpr-a200-0468:11311
Network config: Husky: ROS_IP: 192.168.131.1 ROS_HOSTNAME:cpr-a200-0468
Remote PC: ROS_IP:192.168.131.10 HOSTNAME: rosi
SETUP: All my husky bringup scripts (navsat.launch, um7.launch, base.launch are added as robot_upstart script. Only r2000(laser), hector_mapping, move_base is launched from my remote pc. I can rostopic echo /tf from my remote pc on husky boot up.
I had some issues with the tf frames and time mismatch between the system.
TF_OLD_DATA ignoring data from the past for frame base_link
I solved those using other ros posts, also used chrony for syncing the husky time with my remote pc time. Now I can get the scanned map but when I send the nav goal it does not execute.
I did publish my messages from rviz and tried listening over on husky end:
rostopic echo /move_base_simple/goal
but no message appears on the husky terminal (sshed over wifi). Just to make sure I send some cmd_velocity across the system from the terminal:
husky:
rostopic pub /cmd_vel geometry_msgs/Twist "linea::
x: 0.1
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
publishing and latching message. Press ctrl-C to terminate
remote pc:
rostopic echo /cmd_vel
But I hear nothing but the robot moves. Vice versa:
remote pc: published
husky listening: nothing received
robot does not move.
The launch file launching the laser, hector_mapping and move_base is as follows:
<?xml version="1.0"?>
<launch>
<arg name="frame_id" default="base_laser"/>
<arg name="scanner_ip" default="192.168.131.12"/>
<arg name="scan_frequency" default="35"/>
<arg name="samples_per_scan" default="3600"/>
<!-- R2000 Driver -->
<node pkg="pepperl_fuchs_r2000" type="r2000_node" name="r2000_node" respawn="true" output="screen">
<param name="frame_id" value="$(arg frame_id)"/>
<param name="scanner_ip" value="$(arg scanner_ip)"/>
<param name="scan_frequency" value="$(arg scan_frequency)"/>
<param name="samples_per_scan" value="$(arg samples_per_scan)"/>
</node>
<node pkg="tf" type="static_transform_publisher" name="map_odom_broadcaster" args="0 0 0 0 0 0 map odom 100" />
<node pkg="tf" type="static_transform_publisher" name="odom_baselink_broadcaster" args="0 0 0 0 0 0 odom base_link 100" />
<!--- Run gmapping
<include file="$(find husky_navigation)/launch/gmapping.launch" />-->
<!-- <node pkg="tf" type="static_transform_publisher" name="robot_state" args="0.35 0 0.15 0 0 0 base_link base_laser 10" /> -->
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find husky_description)/urdf/husky.urdf.xacro'" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<!--- Run Hector_mapping -->
<include file="$(find hector_mapping)/launch/mapping_default.launch" />
<!--- Run Move Base -->
<include file="$(find husky_navigation)/launch/move_base.launch" />
<!-- RVIZ -->
<node pkg="rviz" type="rviz" name="$(anon rviz)" respawn="false" output="screen" args="-d $(find pepperl_fuchs_r2000)/rviz/rviz.rviz"/>
</launch>
Images: TF tree view before launching laser, hector_mapping, move_base : C:\fakepath\before.png
rqt_graph before launching laser, hector_mapping, move_base : C:\fakepath\before_launch_laser.png
TF tree view before launching laser, hector_mapping, move_base: C:\fakepath\after.png
rqt_graph before launching laser, hector_mapping, move_base : C:\fakepath\after_laser.png
I cannot figure out why the communication is not happening across the system. Any help will be appreciated. Please let me know if I need to give any other information.
Originally posted by arunavanag on ROS Answers with karma: 277 on 2018-09-06
Post score: 0
Original comments
Comment by Delb on 2018-09-06:
Have you correctly set the variable $ROS_MASTER_URI
?
Comment by arunavanag on 2018-09-06:
Yes, I have the all the topics and laser scan and map coming streaming correctly. Additionally, both hosts are setup at the /etc/hosts communication is setup well i think.
Comment by Delb on 2018-09-06:
Is the issue only with the /cmd_vel topic ?
Can you also edit your question to add the launch file of the remote PC and the one of the robot ?
Comment by arunavanag on 2018-09-06:
Added. Nope it is also the issue with the nav goals... When I send this over rviz: Setting goal: Frame:base_link, Position(0.355, -0.558, 0.000), Orientation(0.000, 0.000, -0.679, 0.734) = Angle: -1.492
I hear nothing on rostopic echo /move_base_simple/goal
at the husky end.
Comment by arunavanag on 2018-09-06:
However I can echo /tf and listen it in my remote pc broadcasted from the husky.
Comment by Delb on 2018-09-06:
Can you provide the rqt_graph
too please ?
It's normal that you can echo the tf because they are created from your remote PC, what nodes are you launching from the husky ?
Comment by Choco93 on 2018-09-06:
I am assuming that you are echoing before you publish from your pc?
Comment by gvdhoorn on 2018-09-06:
Just making sure: can the Husky receive any messages from the PC?
If not: check ROS_IP
and ROS_HOSTNAME
settings and/or get a working DNS setup.
Comment by Delb on 2018-09-06:
Can you try this instead ?
rostopic pub -r 100 /husky_velocity_controller/cmd_vel geometry_msgs/Twist "linear:
x: 0.1
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
Comment by gvdhoorn on 2018-09-06:
I would suggest to first make sure that bi-directional communication is working. Receiving msgs from the Husky is nice, but does not guarantee the other direction also work.
Just use rostopic pub
with a std_msgs/String
on the PC, try to rostopic echo
on the Husky.
Comment by arunavanag on 2018-09-06:
@gvdhoorn you are right, I just figured out the connection has fallen again. I cannot ping my remote pc from husky pc. However I can ping remote to husky. I thought I solved this issue by adding the hostname and ip of the remote in husky pc (/etc/hosts) and vice versa
Comment by arunavanag on 2018-09-06:
Also cannot hear any topic published in remote from husky.
Comment by gvdhoorn on 2018-09-06:
Please update your question with the values of ROS_MASTER_URI
, ROS_IP
and ROS_HOSTNAME
for both machines.
Comment by arunavanag on 2018-09-06:
@gvdhoorn I fixed the issue by setting the ip in my /etc/hosts in both the computer. Now I can hear on both ends. But I still cannot execute my 2D Nav goal, new errors are thrown. I will check the ros answers first for the errors. Or else I will create a new question. I guess that is recommended.
Comment by gvdhoorn on 2018-09-06:\
ROS_IP: 192.168.131.1 ROS_HOSTNAME:cpr-a200-0468
If you set both ROS_HOSTNAME
and ROS_IP
, ROS_HOSTNAME
will take precedence. If cpr-a200-0468
cannot be resolved to an IP, things will stop working.
Either setup a DNS, use avahi
or set only ROS_IP
.