merged master -> ros2

This commit is contained in:
matlabbe
2024-07-21 16:29:49 -07:00
5 changed files with 133 additions and 116 deletions
+2 -1
View File
@@ -7,5 +7,6 @@
}, },
"workspaceMount": "source=${localWorkspaceFolder},target=/ros2_ws/src/rtabmap_ros,type=bind", "workspaceMount": "source=${localWorkspaceFolder},target=/ros2_ws/src/rtabmap_ros,type=bind",
"workspaceFolder": "/ros2_ws", "workspaceFolder": "/ros2_ws",
"postAttachCommand": "echo 'Initialize colcon: source /opt/ros/humble/setup.bash && cd /ros2_ws && colcon build --cmake-args -DRTABMAP_SYNC_MULTI_RGBD=ON -DCMAKE_BUILD_TYPE=Release'" "postAttachCommand": "echo 'Initialize colcon: source /opt/ros/humble/setup.bash && cd /ros2_ws && colcon build --cmake-args -DRTABMAP_SYNC_MULTI_RGBD=ON -DCMAKE_BUILD_TYPE=Release'",
"runArgs": ["--privileged"]
} }
+2 -1
View File
@@ -7,5 +7,6 @@
}, },
"workspaceMount": "source=${localWorkspaceFolder},target=/ros2_ws/src/rtabmap_ros,type=bind", "workspaceMount": "source=${localWorkspaceFolder},target=/ros2_ws/src/rtabmap_ros,type=bind",
"workspaceFolder": "/ros2_ws", "workspaceFolder": "/ros2_ws",
"postAttachCommand": "echo 'Initialize colcon: source /opt/ros/jazzy/setup.bash && cd /ros2_ws && colcon build --cmake-args -DRTABMAP_SYNC_MULTI_RGBD=ON -DCMAKE_BUILD_TYPE=Release'" "postAttachCommand": "echo 'Initialize colcon: source /opt/ros/jazzy/setup.bash && cd /ros2_ws && colcon build --cmake-args -DRTABMAP_SYNC_MULTI_RGBD=ON -DCMAKE_BUILD_TYPE=Release'",
"runArgs": ["--privileged"]
} }
+18
View File
@@ -2593,6 +2593,24 @@ bool convertScanMsg(
double waitForTransform, double waitForTransform,
bool outputInFrameId) bool outputInFrameId)
{ {
// scan message validation check
if(scan2dMsg.angle_increment == 0.0f) {
UERROR("convertScanMsg: angle_increment should not be 0!");
return false;
}
if(scan2dMsg.range_min > scan2dMsg.range_max) {
UERROR("convertScanMsg: range_min (%f) should be smaller than range_max (%f)!", scan2dMsg.range_min, scan2dMsg.range_max);
return false;
}
if(scan2dMsg.angle_increment > 0 && scan2dMsg.angle_max < scan2dMsg.angle_min) {
UERROR("convertScanMsg: Angle increment (%f) should be negative if angle_min(%f) > angle_max(%f)!", scan2dMsg.angle_increment, scan2dMsg.angle_min, scan2dMsg.angle_max);
return false;
}
else if (scan2dMsg.angle_increment < 0 && scan2dMsg.angle_max > scan2dMsg.angle_min) {
UERROR("convertScanMsg: Angle increment (%f) should positive if angle_min(%f) < angle_max(%f)!", scan2dMsg.angle_increment, scan2dMsg.angle_min, scan2dMsg.angle_max);
return false;
}
// make sure the frame of the laser is updated during the whole scan time // make sure the frame of the laser is updated during the whole scan time
rtabmap::Transform tmpT = getMovingTransform( rtabmap::Transform tmpT = getMovingTransform(
scan2dMsg.header.frame_id, scan2dMsg.header.frame_id,
@@ -4,7 +4,7 @@
# #
# Example: # Example:
# 1) Launch simulator (turtlebot4, nav2 and rtabmap): # 1) Launch simulator (turtlebot4, nav2 and rtabmap):
# $ ros2 launch rtabmap_demos turtlebot4_ignition.launch.py # $ ros2 launch rtabmap_demos turtlebot4_ignition_demo.launch.py
# #
# 2) Click on "Play" button on bottom-left of gazebo. # 2) Click on "Play" button on bottom-left of gazebo.
# #
+1 -4
View File
@@ -929,8 +929,6 @@ void OdometryROS::processData(SensorData & data, const std_msgs::msg::Header & h
} }
} }
if(!data.imageRaw().empty() || !data.laserScanRaw().isEmpty())
{
if(odomSensorDataPub_->get_subscription_count()>0 || odomSensorDataFeaturesPub_->get_subscription_count()>0) if(odomSensorDataPub_->get_subscription_count()>0 || odomSensorDataFeaturesPub_->get_subscription_count()>0)
{ {
rtabmap_msgs::msg::SensorData msg; rtabmap_msgs::msg::SensorData msg;
@@ -1036,7 +1034,7 @@ void OdometryROS::processData(SensorData & data, const std_msgs::msg::Header & h
} }
statusDiagnostic_.setStatus(pose.isNull()); statusDiagnostic_.setStatus(pose.isNull());
if(syncDiagnostic_.get() && !pose.isNull()) if(syncDiagnostic_.get())
{ {
double curentRate = 1.0/(this->now()-timeStart).seconds(); double curentRate = 1.0/(this->now()-timeStart).seconds();
syncDiagnostic_->tick(header.stamp, syncDiagnostic_->tick(header.stamp,
@@ -1046,7 +1044,6 @@ void OdometryROS::processData(SensorData & data, const std_msgs::msg::Header & h
} }
previousStamp_ = rtabmap_conversions::timestampFromROS(header.stamp); previousStamp_ = rtabmap_conversions::timestampFromROS(header.stamp);
}
} }
void OdometryROS::resetOdom( void OdometryROS::resetOdom(