How do you publish Hokuyo laser data to a specific frame?
I am trying to do autonomous navigation on a jackal robot equipped with a pointgrey bumblebee2 camera and a Hokuyo laser. I have got the hokuyo laser to publish data to my desired topic (/front/scan) but when I run Rviz I get the error:
Transform [sender=unknown_publisher] For frame [laser]:Frame [laser] does not exist
I have done some debugging and got the message:
MessageFilter [target=odom front_laser]: Added message in frame laser at time ..., count now 50
I think when I run the Hokuyo node by:
rosin hokuyo_node hokuyo_node scan:=/front/scan
that it add the messages to the default laser frame, so I am wondering how to change this so it adds the messages to the front_laser frame.
<?xml version="1.0"?>
<robot name="jackal" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:property name="PI" value="3.1415926535897931" />
<xacro:property name="wheelbase" value="0.262" />
<xacro:property name="track" value="0.37559" />
<xacro:property name="wheel_vertical_offset" value="0.0345" />
<xacro:property name="footprint_vertical_offset" value="-0.0655" />
<xacro:property name="wheel_radius" value="0.098" />
<xacro:property name="wheel_width" value="0.040" />
<xacro:property name="chassis_length" value="0.420" />
<xacro:property name="chassis_width" value="0.310" />
<xacro:property name="chassis_height" value="0.184" />
<xacro:property name="dummy_inertia" value="1e-09"/>
<xacro:property name="mount_spacing" value="0.120" />
<material name="dark_grey"><color rgba="0.2 0.2 0.2 1.0" /></material>
<material name="light_grey"><color rgba="0.4 0.4 0.4 1.0" /></material>
<material name="yellow"><color rgba="0.8 0.8 0.0 1.0" /></material>
<material name="black"><color rgba="0.15 0.15 0.15 1.0" /></material>
<xacro:macro name="wheel" params="prefix *joint_pose">
<link name="${prefix}_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/>
<geometry>
<mesh filename="package://jackal_description/meshes/jackal-wheel.stl"/>
</geometry>
<material name="black" />
</visual>
<collision>
<origin xyz="0 0 0" rpy="${PI/2} 0 0"/>
<geometry>
<cylinder radius="${wheel_radius}" length="${wheel_width}"/>
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.477"/>
<inertia
ixx="0.0013" ixy="0" ixz="0"
iyy="0.0024" iyz="0"
izz="0.0013"/>
</inertial>
</link>
<gazebo reference="${prefix}_wheel_link">
<material>Gazebo/DarkGrey</material>
</gazebo>
<joint name="${prefix}_wheel" type="continuous">
<parent link="chassis_link"/>
<child link="${prefix}_wheel_link" />
<xacro:insert_block name="joint_pose" />
<axis xyz="0 1 0" />
</joint>
<!-- In reality, Jackal has only two motors, one per side. However, it's more
straightforward for Gazebo to simulate as if there's an actuator per wheel. -->
<transmission name="${prefix}_wheel_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${prefix}_wheel">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="${prefix}_actuator">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
</xacro:macro>
<xacro:wheel prefix="front_left">
<origin xyz="${wheelbase/2} ${track/2} ${wheel_vertical_offset}" rpy="0 0 0" />
</xacro:wheel>
<xacro:wheel prefix="front_right">
<origin xyz="${wheelbase/2} ${-track/2} ${wheel_vertical_offset}" rpy="0 0 0" />
</xacro:wheel>
<xacro:wheel prefix="rear_left">
<origin xyz="${-wheelbase/2} ${track/2} ${wheel_vertical_offset}" rpy="0 0 0" />
</xacro:wheel>
<xacro:wheel prefix="rear_right">
<origin xyz="${-wheelbase/2} ${-track/2} ${wheel_vertical_offset}" rpy="0 0 0" />
</xacro:wheel>
<link name="base_link"></link>
<joint name="base_link_joint" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0" />
<parent link="base_link"/>
<child link="chassis_link" />
</joint>
<link name="chassis_link">
<visual>
<origin xyz="0 0 ${footprint_vertical_offset}" rpy="${PI/2} 0 ${PI/2}"/>
<geometry>
<mesh filename="package://jackal_description/meshes/jackal-base.stl"/>
</geometry>
<material name="dark_grey" />
</visual>
<collision>
<origin xyz="0 0 ${chassis_height/2}"/>
<geometry>
<box size="${chassis_length} ${chassis_width} ${chassis_height}"/>
</geometry>
</collision>
<inertial>
<!-- Center of mass -->
<origin xyz="0.012 0.002 0.067" rpy="0 0 0"/>
<mass value="16.523"/>
<!-- Moments of inertia: ( chassis without wheels ) -->
<inertia
ixx="0.3136" ixy="-0.0008" ixz="0.0164"
iyy="0.3922" iyz="-0.0009"
izz="0.4485"/>
</inertial>
</link>
<link name="fenders_link">
<visual>
<origin xyz="0 0 ${footprint_vertical_offset}" rpy="${PI/2} 0 ${PI/2}"/>
<geometry>
<mesh filename="package://jackal_description/meshes/jackal-fenders.stl"/>
</geometry>
<material name="yellow" />
</visual>
</link>
<joint name="fenders_joint" type="fixed">
<parent link="chassis_link" />
<child link="fenders_link" />
</joint>
<!-- TODO: Make this internal_imu_link or something, and use a mixed-in xacro
to supply the joint between it and imu_link. This is important so that imu_link
always points to the "active" IMU. When an upgrade IMU is connected, the
internal_imu_link should remain, but imu_link should point to the upgrade one. -->
<link name="imu_link">
<inertial>
<mass value="0.001"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<inertia ixx="${dummy_inertia}" ixy="0.0" ixz="0.0" iyy="${dummy_inertia}" iyz="0.0" izz="${dummy_inertia}"/>
</inertial>
</link>
<joint name="imu_joint" type="fixed">
<parent link="chassis_link" />
<child link="imu_link" />
</joint>
<!-- TODO: Same note as applies to imu_link -->
<link name="navsat_link">
<visual>
<geometry>
<cylinder radius="0.026" length="0.016" />
</geometry>
<origin xyz="0 0 0.008" />
<material name="black" />
</visual>
</link>
<joint name="navsat_joint" type="fixed">
<parent link="chassis_link" />
<child link="navsat_link" />
<origin xyz="-0.180 0.126 0.1815" />
</joint>
<link name="mid_mount"></link>
<joint name="mid_mount_joint" type="fixed">
<parent link="chassis_link" />
<child link="mid_mount" />
<origin xyz="0 0 ${chassis_height}" />
</joint>
<link name="rear_mount"></link>
<joint name="rear_mount_joint" type="fixed">
<parent link="mid_mount" />
<child link="rear_mount" />
<origin xyz="${-mount_spacing} 0 0" />
</joint>
<link name="front_mount"></link>
<joint name="front_mount_joint" type="fixed">
<parent link="mid_mount" />
<child link="front_mount" />
<origin xyz="${mount_spacing} 0 0" />
</joint>
<!-- NEW STUFF/HOKUYO BASE -->
<link name="hokuyo_base_link">
<visual>
<origin xyz="0.143 0 0.2" rpy="0 0 0"/>
<geometry>
<box size="0.12 0.1 0.08"/>
</geometry>
<material name="yellow" />
</visual>
</link>
<joint name="hokuyo_base_joint" type="fixed">
<parent link="chassis_link" />
<child link="hokuyo_base_link" />
</joint>
<!-- THIS IS THE NEW STUFF HERE -->
<link name="front_laser">
<collision>
<origin xyz="0.143 0 0.25" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 0.1" />
</geometry>
</collision>
<visual>
<!-- Move the hokuyo around by cahnging the origin below -->
<origin xyz="0 0 -0.02" rpy="0 0 0"/>
<!--origin xyz="0 0 0" rpy="0 0 0"/-->
<geometry>
<mesh filename="package://jackal_description/meshes/hokuyo.dae"/>
</geometry>
</visual>
<inertial>
<mass value="1e-5" />
<origin xyz="0 0 0" rpy="0 0 0"/>
<inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
</inertial>
</link>
<joint name="hokuyo_joint" type="fixed">
<origin xyz="0.143 0 0.27" rpy="0 0 0"/>
<parent link="hokuyo_base_link" />
<child link="front_laser" />
</joint>
<!-- END OF NEW STUFF HERE -->
<!-- Bring in simulation data for Gazebo. -->
<xacro:include filename="$(find jackal_description)/urdf/jackal.gazebo" />
<!-- Optional standard accessories, including their simulation data. The rendering
of these into the final description is controlled by optenv variables, which
default each one to off.-->
<xacro:include filename="$(find jackal_description)/urdf/accessories.urdf.xacro" />
<!-- Optional custom includes. -->
<xacro:include filename="$(optenv JACKAL_URDF_EXTRAS empty.urdf)" />
</robot>
Asked by dkrivet on 2018-07-13 05:24:32 UTC
Answers
A previous version of the hokuyo_node wiki page documented the available ROS parameters; among them is one for setting the published frame id: frame_id
.
You can supply this parameter when you run the node with rosrun like this;
rosrun hokuyo_node hokuyo_node scan:=/front/scan _frame_id:=/front_laser
Asked by ahendrix on 2018-11-20 17:58:15 UTC
Comments
I've fixed the hokuyo_node wiki page so that it now displays the full set of ROS parameters again.
Asked by ahendrix on 2018-11-20 17:59:48 UTC
Comments
do you have the transformation between the frame of your laser and another frame of your robot like base_link ?
Asked by kesuke on 2018-07-13 07:43:40 UTC
I have a transformation between front_laser and chassis_link which I think would be sufficient but the hokuyo_node adds messages to "laser" if I'm not mistaken. I could be wrong, I'm very new to ROS
Asked by dkrivet on 2018-07-13 08:08:14 UTC
when you run rviz what do you put on the fixed frame ? do you see any laser data on rviz ?
Asked by kesuke on 2018-07-13 08:26:24 UTC
No I am not able to see the laser data in Rviz. I just get the error as mentioned above:Transform [sender=unknown_publisher] For frame [laser]:Frame [laser] does not exist
Asked by dkrivet on 2018-07-13 08:27:36 UTC
However when I do rostopic echo /front/scan I am able to confirm that the laser is indeed publishing data to the /front/scan topic
Asked by dkrivet on 2018-07-13 08:31:15 UTC
ok so run hokuyo node and rviz , on the fixed frame type the word ( laser ) and tell meif you see laser data on rviz
Asked by kesuke on 2018-07-13 08:32:36 UTC
Sorry where do I type laser? I don't see the drop down menu for fixed frame. so sorry, I am very very new to ROS
Asked by dkrivet on 2018-07-13 08:43:04 UTC
on rviz on the section " fixed frame " if you can't see 'laser' type it with manually with your keyboard
Asked by kesuke on 2018-07-13 08:45:02 UTC
Yes when I do this I can indeed see the laser data
Asked by dkrivet on 2018-07-13 08:51:35 UTC
Also in the ssh terminal where I am running roslaunch jackal_navigation odom_navigation_demo.launch I get a warning saying "MessageFilter [target=odom from_laser]: Dropped 100% of messages so far"
Asked by dkrivet on 2018-07-13 08:53:54 UTC
good , so i think you have a little trouble with the transformation , try to run 'roswtf' to ckeck if there are some errors , and do 'rosrun rqt_tf_tree rqt_tf_tree' to get your tf tree it's gone be helpful if you can publish it here
Asked by kesuke on 2018-07-13 09:02:44 UTC
I will attach the screenshots now
Asked by dkrivet on 2018-07-13 09:08:56 UTC
C:\fakepath\TFTREE.png
C:\fakepath\ROSWTF.png
Asked by dkrivet on 2018-07-13 09:11:04 UTC
Are you able to see the screens hotted outputs Ive attached?
Asked by dkrivet on 2018-07-13 09:11:38 UTC
yes i'm able to see them , but next often you can directly edit your question and add yours images without using fake path , anyway i'm not able to see in your tf tree the frame of the laser there are not transformation between base_laser and chassis_link
Asked by kesuke on 2018-07-13 09:27:19 UTC
I don't know why this is the case because in my jackal.urdf.xacro file I have a link and joint describing both the hokuyo_base and the hokuyo_laser so I have no idea why they are not appearing in the TF tree
Asked by dkrivet on 2018-07-13 10:46:07 UTC
can you upload your xacro file ?
Asked by kesuke on 2018-07-16 02:23:40 UTC
I have edited my original question to include the contents of my jackal.urdf.xacro file although the formatting when I posted it is a bit weird unfortunately
Asked by dkrivet on 2018-07-16 03:15:33 UTC
As you can see, I have a hokuyo_base_link that serves as the base of the hokuyo laser, and I have a front_laser link which is the hokuyo laser, but for some reason these are not showing up in the tf tree
Asked by dkrivet on 2018-07-16 03:22:51 UTC
first try to correct the code that you upload it's a bit complicated to read , the format of the code have to be aligned so please try to range a little bit the code for example : sould have the same vertical allignement with
Asked by kesuke on 2018-07-16 07:43:31 UTC
Sorry I will try to upload it so that the formatting is correct. It is indented properly on the jackal where I am using it. However, it seems that even when I make changes to the jackal.urdf.xacro file that it doesn't change the tf tree of the jackal
Asked by dkrivet on 2018-07-16 08:07:21 UTC
It seems as if there is a default jackal.urdf.xacro file that is used when the jackal boots up, and any changes that i make to the jackal.urdf.xacro file in my jackal_navigation workspace has no effect on the tf tree
Asked by dkrivet on 2018-07-16 08:08:11 UTC
so if understand you have two jackal.urdf.xacro ? if you don't see any changes are you sure that you are runing the right launch file that you created on the worspace instead of the one that maybe is on the stack ?
Asked by kesuke on 2018-07-16 08:30:57 UTC
So I have a jackal.urdf.xacro file in the workspace that I created: ~/jackal_navigation/src/jackal/jackal/description/urdf and there is another one in the path: /opt/ros/indigo/share/jackal_description.urdf and if I'm not mistaken jackal uses the second file by default when it boots?
Asked by dkrivet on 2018-07-16 08:34:49 UTC
(boots ) not exactly you problem is that ros don't know the path of your file on the workspace , are you sure that you workspace is configured ? i'm not seeing 'catkin_ws' on the path
Asked by kesuke on 2018-07-16 08:47:33 UTC
I believe it was configured properly. I have just modified the jackal.urdf.xacro file in the second path that I listed above and rebooted jackal and that seems to have done the trick. The tf tree now looks like how I want it to and the nav stack is working properly.
Asked by dkrivet on 2018-07-16 08:49:19 UTC
great i'm happy for you , then if you think that you problem is solved please check the green button to close the discussion
Asked by kesuke on 2018-07-16 09:05:18 UTC
Thank you so much for all of your help! I really appreciate it :)
Asked by dkrivet on 2018-07-16 09:06:04 UTC
@dkrivet you welcom
Asked by kesuke on 2018-07-16 09:09:40 UTC
Can you please put these images directly into your question instead of using an answer to provide more information about your question. This isn't a forum.
Asked by jayess on 2018-07-17 11:35:34 UTC
I'm running into exactly the same problem. Did you solve it? Thank you!
Asked by kyleGao on 2018-11-20 13:00:41 UTC