lge-ros2 / cloisim_ros

ROS2 simulation device packages to connect unity based multi-robot simulator CLOisim.
MIT License
11 stars 5 forks source link

Wrong LaserScan metadata #44

Open eborghi10 opened 3 years ago

eborghi10 commented 3 years ago

Describe the bug

The metadata of the LaserScan topic has incorrect values. This can be easily reproduced using slam_toolbox.

To Reproduce

  1. Run cloisim
  2. Run cloisim_ros
  3. Install slam_toolbox package and run ros2 launch slam_toolbox online_async_launch.py
  4. A message throwing an error appears:

[async_slam_toolbox_node-1] LaserRangeScan contains 1081 range readings, expected 1082

Expected behavior

No errors should be seen and the Tf between odom and map should be provided by SLAM Toolbox.

A way of fixing this issue can be seen here: https://github.com/allenh1/rplidar_ros/pull/18/files.


I used Docker to bringup Cloisim:

export CLOISIM_RESOURCES_PATH=$HOME/cloisim/sample_resources

xhost +
docker run -ti --rm --gpus all --net=host \
    -e DISPLAY \
    -v /tmp/.Xauthority:/tmp/.Xauthority \
    -v /tmp/cloisim/unity3d:/root/.config/unity3d \
    -v /tmp/.X11-unix:/tmp/.X11-unix  \
    -v /usr/share/fonts/:/usr/share/fonts/ \
    -v ${CLOISIM_RESOURCES_PATH}/media:/opt/resources/media/ \
    -v ${CLOISIM_RESOURCES_PATH}/meshes:/opt/resources/meshes/ \
    -v ${CLOISIM_RESOURCES_PATH}/models:/opt/resources/models/ \
    -v ${CLOISIM_RESOURCES_PATH}/photos:/opt/resources/photos/ \
    -v ${CLOISIM_RESOURCES_PATH}/worlds:/opt/resources/worlds/ \
    cloisim $1
export CLOISIM_BRIDGE_IP=$(ip addr show dev docker0 | grep "inet" | awk 'NR==1{print $2}' | cut -d'/' -f 1)
echo $CLOISIM_BRIDGE_IP

export ROS_DOMAIN_ID=22

docker run -it --rm \
    -e CLOISIM_BRIDGE_IP=$CLOISIM_BRIDGE_IP \
    -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID \
    cloisim_ros $1
hyunseok-yang commented 3 years ago

@eborghi10 Hi, which version do you use for CLOiSim? :)

hyunseok-yang commented 3 years ago

@eborghi10 I'd a look the history commit is CLOiSim. And I found some history exactly what you point out. I've fixed by someone else who already raised the issue like you mentioned at that time.

here is a link the commit

And the fix is still there despite the code are refactored several times since the fix commit, here you can see the code

hyunseok-yang commented 3 years ago

@eborghi10 Oh, and I tried to reproduce the guide as you mentioned above with latest version of CLOiSim and cloisim_ros.

I couldn't see the error message if it is correct reproduction. :)

eborghi10 commented 3 years ago

Thanks for your quick reply, @hyunseok-yang! I was using the image from Docker Hub, maybe it needs to be updated.

I'll try again compiling the image from main branch and close this ticket if it works.

hyunseok-yang commented 3 years ago

@eborghi10 Do you mean docker hub?? here?

If is so, actually I didn't create and manage those by myself :( I didn't realize it exists on Docker hub.

I'll contact the person who managing and clean up the registry

hyunseok-yang commented 3 years ago

Thanks for your quick reply, @hyunseok-yang! I was using the image from Docker Hub, maybe it needs to be updated.

I'll try again compiling the image from main branch and close this ticket if it works.

if you try the main branch, please use the latest CLOiSim version. https://github.com/lge-ros2/cloisim/releases/tag/2.5.0

foxy branch is more proper for CLOiSim-2.5.0 but, as you can see, there is no big difference between main branch.. so let me know after try :)

eborghi10 commented 3 years ago

Regarding cloisim, the dockerfile is already using the latest tag release.

But cloisim_ros uses foxy branch which has a bug (see here) that is fixed in main.

However, using these two docker images, I'm getting two errors:

hyunseok-yang commented 3 years ago

@eborghi10 Right, there was typo in package.xml and you may have seen the error during build after rosdep command :(

So I just released the foxy branch including the fix.

hyunseok-yang commented 3 years ago

@eborghi10
And, in terms of this error, it occurs when the communication with CLOiSim has been disconnected or some of parts in model(robot) had something wrong.

  • In cloisim_ros: [Receive][444] failed to receive message(-1): Resource temporarily unavailable

This case, I think micom plugin in CLOi Porter(robot) had problem. sorry for inconvenience, I usually testing another robot(internal) in my company :(

So, I just fixed the resources. could you re-check with latest version of samples_resources? https://github.com/lge-ros2/sample_resources/releases/tag/v1.6.1

hyunseok-yang commented 3 years ago

@eborghi10

Next, I've investigated the issue below. and I found some history regarding the problem. Also, I ran the latest of CLOiSim + cloisim_ros with slam_toolbox(latest version 2.4.0 which can be installed via apt-get install) and checked the laserScan data.

  • Running slam_toolbox: [async_slam_toolbox_node-1] LaserRangeScan contains 1081 range readings, expected 1082

There was exactly same issue with slam_toolbox 2.3.0 and I just modified the code to suppress the error log at that time. That fix was this commit.

But, after several weeks? months?, the fix has been pushed into foxy-devel branch of slam_toolbox. And now the fix is reflected in latest version 2.4.0.

I think the main point of fix or issue is that range count checks whether 360 degree case or not. I should modify the code in CLOiSim side considering 360 degree of laser parts case.

I will let you know when fix and release is ready.

hyunseok-yang commented 3 years ago

@eborghi10 Hi, I release the latest version of CLOiSim-2.5.1.

Try it and let me know how it worked for you :) I couldn't see the error print with this.

eborghi10 commented 3 years ago

So I just released the foxy branch including the fix.

foxy-2.11.3 still has the typo, see here.

Because of that, I tested CLOiSim-2.5.1 and CLOiSim-ROS-main but It still failed. Just to make sure we're running the same setup, I'm running this for slam toolbox:

sudo apt-get update && sudo apt-get install -y ros-foxy-slam-toolbox ros-foxy-navigation2 ros-foxy-nav2-bringup

ros2 launch slam_toolbox online_async_launch.py
hyunseok-yang commented 3 years ago

@eborghi10 oops.. sorry.. my bad.. I released the tag on same commit id of foxy-2.11.2. Here is real one -> 2.11.3

Why don't you try singlemode first? maybe namespace in topic could be a problem. Because 'scan_topic' parameter is an absolute path as scan topic name.

$ vi /opt/ros/foxy/share/slam_toolbox/config/mapper_params_online_async.yaml 
1. run CLOiSim
2. $ ros2 launch cloisim_ros_bringup bringup.launch.py **singlemode:=True**
3. $ ros2 launch slam_toolbox online_async_launch.py
hyunseok-yang commented 3 years ago

@eborghi10 Hi, there was bug related to odometry with CLOiSim-2.5.1.

After fix the potential issue and minor change for UI, release new version of CLOiSim. Also, we've tested driving using navigation2 and it worked well.

Here are the package set of simulation. I hope these are helpful to you