Skip to content

Commit 069e69e

Browse files
committed
implemented cpp part for universal semantic mapping. I did not format the code yet as it would be hard to recognize the canges
1 parent 7fcb58b commit 069e69e

File tree

12 files changed

+597
-59
lines changed

12 files changed

+597
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.pyc
22
*.bkp
33
*.orig
4+
.idea

elevation_mapping_cupy/config/parameters.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ max_unsafe_n: 10 # if the number of cells under s
4040
overlap_clear_range_xy: 4.0 # xy range [m] for clearing overlapped area. this defines the valid area for overlap clearance. (used for multi floor setting)
4141
overlap_clear_range_z: 2.0 # z range [m] for clearing overlapped area. cells outside this range will be cleared. (used for multi floor setting)
4242

43-
map_frame: 'odom' # The map frame where the odometry source uses.
44-
base_frame: 'base' # The robot's base frame. This frame will be a center of the map.
45-
corrected_map_frame: 'corrected_odom'
43+
map_frame: 'enu' # The map frame where the odometry source uses.
44+
base_frame: 'base_footprint' # The robot's base frame. This frame will be a center of the map.
45+
corrected_map_frame: 'enu'
4646

4747
#### Feature toggles ########
4848
enable_edge_sharpen: true
@@ -64,13 +64,7 @@ use_only_above_for_upper_bound: false
6464
plugin_config_file: '$(rospack find elevation_mapping_cupy)/config/plugin_config.yaml'
6565

6666
#### Subscribers ########
67-
pointcloud_topics: ['/depth_camera_front/depth/color/points',
68-
'/depth_camera_rear/depth/color/points',
69-
'/depth_camera_left/depth/color/points',
70-
'/depth_camera_right/depth/color/points',
71-
'/robot_self_filter/bpearl_front/point_cloud',
72-
'/robot_self_filter/bpearl_rear/point_cloud'
73-
]
67+
7468

7569
#### Publishers ########
7670
# topic_name:
@@ -93,7 +87,7 @@ publishers:
9387

9488
#### Initializer ########
9589
initialize_method: 'linear' # Choose one from 'nearest', 'linear', 'cubic'
96-
initialize_frame_id: ['RF_FOOT', 'LF_FOOT', 'RH_FOOT', 'LH_FOOT'] # One tf (like ['footprint'] ) initializes a square around it.
90+
initialize_frame_id: ['base_footprint'] # One tf (like ['footprint'] ) initializes a square around it.
9791
initialize_tf_offset: [0.0, 0.0, 0.0, 0.0] # z direction. Should be same number as initialize_frame_id.
9892
dilation_size_initialize: 5 # dilation size after the init.
9993
initialize_tf_grid_size: 0.4 # This is not used if number of tf is more than 3.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
subscribers:
2+
# sensor_name:
3+
# channels: ['feat_0','feat_1']
4+
# fusion: ['average','average']
5+
# topic_name: '/elevation_mapping/pointcloud_semantic'
6+
front_cam:
7+
channels: ['feat_0','feat_1']
8+
fusion: ['average','average']
9+
topic_name: '/elvation_mapping/pointcloud_semantic'

elevation_mapping_cupy/include/elevation_mapping_cupy/elevation_mapping_ros.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace elevation_mapping_cupy {
4848
class ElevationMappingNode {
4949
public:
5050
ElevationMappingNode(ros::NodeHandle& nh);
51+
using RowMatrixXd = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
5152

5253
private:
5354
void readParameters();

elevation_mapping_cupy/include/elevation_mapping_cupy/elevation_mapping_wrapper.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
// Pybind
1515
#include <pybind11_catkin/pybind11/embed.h> // everything needed for embedding
16+
#include <pybind11/stl.h>
1617

1718
// ROS
1819
#include <geometry_msgs/PoseWithCovarianceStamped.h>
@@ -42,11 +43,11 @@ class ElevationMappingWrapper {
4243

4344
ElevationMappingWrapper();
4445

45-
void initialize(ros::NodeHandle& nh);
46+
void initialize(ros::NodeHandle& nh, std::vector<std::string> additional_layers, std::vector<std::string> fusion_algorithms);
4647

47-
void input(const pcl::PointCloud<pcl::PointXYZ>::Ptr& pointCloud, const RowMatrixXd& R, const Eigen::VectorXd& t,
48+
void input(const RowMatrixXd& points, const std::vector<std::string>& channels, const RowMatrixXd& R, const Eigen::VectorXd& t,
4849
const double positionNoise, const double orientationNoise);
49-
void move_to(const Eigen::VectorXd& p);
50+
void move_to(const Eigen::VectorXd& p, const RowMatrixXd& R);
5051
void clear();
5152
void update_variance();
5253
void update_time();
@@ -57,11 +58,10 @@ class ElevationMappingWrapper {
5758
std::vector<Eigen::Vector2d>& untraversable_polygon);
5859
double get_additive_mean_error();
5960
void initializeWithPoints(std::vector<Eigen::Vector3d>& points, std::string method);
60-
void pointCloudToMatrix(const pcl::PointCloud<pcl::PointXYZ>::Ptr& pointCloud, RowMatrixXd& points);
6161
void addNormalColorLayer(grid_map::GridMap& map);
6262

6363
private:
64-
void setParameters(ros::NodeHandle& nh);
64+
void setParameters(ros::NodeHandle& nh, std::vector<std::string> additional_layers, std::vector<std::string> fusion_algorithms);
6565
py::object map_;
6666
py::object param_;
6767
double resolution_;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<launch>
2+
<arg name="use_sim_time" default="true" />
3+
<arg name="model" default="$(find rowesys_description)/urdf/rowesys.urdf.xacro"/>
4+
5+
<param name="/use_sim_time" type="bool" value="$(arg use_sim_time)" />
6+
<param name="robot_description" command="$(find xacro)/xacro '--inorder' $(arg model)" />
7+
8+
<!-- <node pkg="elevation_mapping_cupy" type="pointcloud.py" name="pointcloud" output="screen" >-->
9+
<!-- <param name="/use_sim_time" type="boolean" value="$(arg use_sim_time)" />-->
10+
<!-- <param name="cam_name" type="string" value="semantic_parameters" />-->
11+
<!-- <rosparam command="load" file="$(find elevation_mapping_cupy)/config/semantic_parameters.yaml" />-->
12+
<!-- </node>-->
13+
14+
<!-- Elevation mapping node -->
15+
<node pkg="elevation_mapping_cupy" type="elevation_mapping_node" name="elevation_mapping" output="screen" >
16+
<param name="/use_sim_time" type="bool" value="$(arg use_sim_time)" />
17+
<rosparam command="load" file="$(find elevation_mapping_cupy)/config/parameters.yaml" />
18+
<rosparam command="load" file="$(find elevation_mapping_cupy)/config/sensor_parameter.yaml" />
19+
</node>
20+
21+
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find elevation_mapping_cupy)/rviz/lonomy_single.rviz"/>
22+
</launch>
23+
<!-- launch-prefix="gdb -ex run - -args"-->

0 commit comments

Comments
 (0)