Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem displaying laser scan #132

Open
Cavalletta98 opened this issue Feb 14, 2023 · 13 comments
Open

Problem displaying laser scan #132

Cavalletta98 opened this issue Feb 14, 2023 · 13 comments
Assignees
Labels

Comments

@Cavalletta98
Copy link

Hi, i'm running on Ubuntu 20.04 with ROS Foxy and i'm trying to echo the laser topic with the command ros2 topic echo /front/scan. I'm getting this error Cannot echo topic '/front/scan', as it contains more than one type: [sensor_msgs/msg/LaserScan, sensor_msgs/msg/PointCloud2].. Can you please help me?
Thanks

@tonybaltovski
Copy link
Member

Hi @Cavalletta98 can you please provide the asked for information so we can have a starting point to help you? In particular, how did you enable the laser?

For reference:

**Please provide the following information:**
 - OS: (e.g. Ubuntu 18.04)
 - ROS Distro: (e.g. Melodic)
 - Built from source or installed:
 - Package version: (if from repository, give version from `sudo dpkg -s ros-$ROS_VERSION-jackal-PACKAGE_WITH_ISSUE`, if from source, give commit hash)
 - Real hardware or simulation:

 **Expected behaviour**
 A clear and concise description of what you expected to happen.

 **Actual behaviour**
 A clear and concise description of what you encountered.

**To Reproduce**
Provide the steps to reproduce:
1. run something
2. launch something else
3. see the error


**Other notes**
Add anything else you thing is important.

@Cavalletta98
Copy link
Author

Cavalletta98 commented Feb 14, 2023

@tonybaltovski I run the command export JACKAL_LASER=1. Then i'm running ros2 launch jackal_gazebo jackal_world.launch.py and
nav.launch.zip
Once i do the echo, i got the error pointed in the previous comment

@tonybaltovski
Copy link
Member

Thanks! I was able to reproduce the issue and the fix is #133. Please give that a try.

@Cavalletta98
Copy link
Author

Cavalletta98 commented Feb 14, 2023

@tonybaltovski The fix worked for the echo command. When i run my launch file provided to you before, i got this errors [controller_server-2] [INFO] [1676395444.311756939] [local_costmap.local_costmap_rclcpp_node]: Message Filter dropping message: frame 'front_laser' at time 1573.970 for reason 'Unknown' and [async_slam_toolbox_node-1] [INFO] [1676395608.487225851] [slam_toolbox]: Message Filter dropping message: frame 'front_laser' at time 1714.683 for reason 'Unknown'.
The second error Is due to launching the slam launch file inside the jackal navigation

@Cavalletta98
Copy link
Author

@tonybaltovski I noticed that if i launch the simulation with ros2 launch jackal_gazebo jackal_world.launch.py and i do ros2 topic echo /front/scan , i'm able to see the laser scan values. But, if i also run my launch file, i cannot see the laser scan values with the command ros2 topic echo /front/scan . Probably there is something wrong in the navigation config

@tonybaltovski
Copy link
Member

Can you set use_sim_time to true? Can you provide the output of when you launch your launch file as well as ros2 launch jackal_gazebo jackal_world.launch.py?

@Cavalletta98
Copy link
Author

Cavalletta98 commented Feb 16, 2023

@tonybaltovski I setted use_sim_time to true. I attached the two logs files
my_launch_file_log.txt
Jackal_world_launch_log.txt
Have a look to the other issue; probably they are correlated

@tonybaltovski
Copy link
Member

We are able to reproduce the issue and will get back to you.

@Cavalletta98
Copy link
Author

Thanks. I think the two issue are related. I was able to visualize the robot in the map
frame in rviz but not able to show the map built from the slam toolbox

@DrAndyWest
Copy link

DrAndyWest commented Feb 23, 2023

Hi All,
I have had this issue with the Jackal in sim on Foxy. I have found that the timestamps don't seem to match between the robot state publisher and the laser scan. The laser scan appears to be in sim time (small timestamp numbers when ros2 topic echo /front/scan), whereas other parts are using wall time (clearly epoch values, e.g. using tf viewer in rqt). Running RVIZ gladly shows the scan in base_link frame, but slam_toolbox can't produce maps as a result.

Using ros2 param get <node> use_sim_time, there appears to be a mix of true & false.

@Cavalletta98
Copy link
Author

@DrAndyWest HAve you solved it?

@DrAndyWest
Copy link

DrAndyWest commented Mar 6, 2023

Hi All,
I have managed to get things working. I found a few launch files/nodes not using or passing use_sim_time=true, this leads to the robot sim TF and nodes having different timestamps to the gazebo sensors. Now SLAM Toolbox can generate a map from the lidar scan.

jackal_gazebo/gazebo.launch.py
Line 95 and Line 59 call launch files, parameters can be successfully passed using a dictionary rather than list launch_arguments={'robot_description_command': robot_description_command,'is_sim':'True',}.items(). No need to add additional parameters to 'spawn_jackal' for example.

Additional 'is_sim' argument is required for the teleop include on Line 101.

jackal_description/description.launch.py
Does not have an is_sim argument, e.g.

is_sim_arg = DeclareLaunchArgument('is_sim', default_value='False')
is_sim = LaunchConfiguration('is_sim')
# Declare the launch argument using
ld.add_action(is_sim_arg)
# or
# ld = LaunchDescription([is_sim_arg])

The robot_state_publisher node line needs to include use_sim_time, e.g.parameters=[{'use_sim_time': is_sim}, {'robot_description': robot_description_content},]

jackal_control/teleop_base.launch.py
Needs to have an is_sim argument added (same as above)
Arguments need to be passed to the interactive_marker_twist_server node and the twist_mux node. However, this might be unnecessary.

jackal_control/control.launch.py
This was the major thing to fix.
Add use_sim_time parameter to ekf_node and imu_filter node.

Annoyingly, the control nodes cannot have use_sim_time arguments passed to them using launch arguments (see this issue). We must amend the jackal_control/config/control.yaml file.

jackal_control/config/control.yaml

controller_manager:
  ros__parameters:
    use_sim_time: true
    update_rate: 50  # Hz

User beware! I noticed that the Jackal hardware uses this control code too (see here). Therefore, hard-coding in use_sim_time: true is kind of risky. As I use both sim and hardware I will have to be careful.

As this is a decision to be made by Clearpath how to handle this use_sim_time issue for the controller manager (which gets passed to jackal_velocity_controller and joint_state_broadcaster), I don't think a PR request and pushing my changes is sensible.

brendoncintas added a commit to brendoncintas/jackal that referenced this issue May 21, 2023
@Cavalletta98
Copy link
Author

Hi @DrAndyWest i have done all you suggestion but still not working. In particular, when i launch ros2 launch jackal_navigation nav2.launch.py use_sim_time:=true i'm receiving the following error [controller_server-2] [INFO] [1692190419.797064326] [local_costmap.local_costmap_rclcpp_node]: Message Filter dropping message: frame 'front_laser' at time 1526.503 for reason 'Unknown'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants