├── .gitignore
├── navigation_layers
├── CMakeLists.txt
├── CHANGELOG.rst
└── package.xml
├── range_sensor_layer
├── README.md
├── costmap_plugins.xml
├── scripts
│ └── send_message.py
├── cfg
│ └── RangeSensorLayer.cfg
├── package.xml
├── CHANGELOG.rst
├── CMakeLists.txt
├── include
│ └── range_sensor_layer
│ │ └── range_sensor_layer.h
└── src
│ └── range_sensor_layer.cpp
└── social_navigation_layers
├── costmap_plugins.xml
├── CHANGELOG.rst
├── cfg
└── ProxemicLayer.cfg
├── package.xml
├── include
└── social_navigation_layers
│ ├── proxemic_layer.h
│ └── social_layer.h
├── CMakeLists.txt
└── src
├── social_layer.cpp
├── proxemic_layer.cpp
└── passing_layer.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 |
--------------------------------------------------------------------------------
/navigation_layers/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(navigation_layers)
3 | find_package(catkin REQUIRED)
4 | catkin_metapackage()
5 |
--------------------------------------------------------------------------------
/range_sensor_layer/README.md:
--------------------------------------------------------------------------------
1 | # Decay option
2 |
3 | - use_decay : Allow the layer to use a decay on the pixel marked. By default set at false.
4 | - pixel_decay : Time decay in seconds. By default set at 10.0.
5 |
6 |
--------------------------------------------------------------------------------
/range_sensor_layer/costmap_plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | A range-sensor (sonar, IR) based obstacle layer for costmap_2d
4 |
5 |
6 |
--------------------------------------------------------------------------------
/navigation_layers/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package navigation_layers
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2018-08-31)
6 | ------------------
7 | * Clean up with roscompile
8 | * Contributors: David V. Lu
9 |
10 | 0.2.4 (2014-12-10)
11 | ------------------
12 |
13 | 0.2.3 (2014-12-10)
14 | ------------------
15 |
--------------------------------------------------------------------------------
/range_sensor_layer/scripts/send_message.py:
--------------------------------------------------------------------------------
1 | import rospy
2 | from sensor_msgs.msg import Range
3 |
4 | rospy.init_node('sender')
5 | r = Range()
6 |
7 | r.header.frame_id = '/base_laser_link'
8 | r.field_of_view = 25*3.14/180
9 | r.max_range = 100
10 | r.range = 1
11 |
12 | pub = rospy.Publisher('/sonar', Range)
13 |
14 | while not rospy.is_shutdown():
15 | r.header.stamp = rospy.Time.now()
16 | pub.publish(r)
17 |
18 | rospy.sleep(5)
19 |
--------------------------------------------------------------------------------
/social_navigation_layers/costmap_plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Uses people information to change the costmap
4 |
5 |
6 | Uses people information to change the costmap
7 |
8 |
9 |
--------------------------------------------------------------------------------
/navigation_layers/package.xml:
--------------------------------------------------------------------------------
1 |
2 | navigation_layers
3 | 0.5.0
4 | Extra navigation layers.
5 | David V. Lu!!
6 | David V. Lu!!
7 | BSD
8 |
9 | catkin
10 | range_sensor_layer
11 | social_navigation_layers
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/social_navigation_layers/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package social_navigation_layers
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.2.3 (2014-12-10)
6 | ------------------
7 |
8 | 0.4.0 (2018-08-31)
9 | ------------------
10 | * Clean up with roscompile
11 | * Contributors: David V. Lu
12 |
13 | 0.2.4 (2014-12-10)
14 | ------------------
15 |
16 | 1.0.4 (2014-07-09)
17 | ------------------
18 | * merging Social Navigation Layer into people
19 | * Contributors: David Lu!!
20 |
21 | 1.0.3 (2014-03-01)
22 | ------------------
23 |
24 | 1.0.2 (2014-02-28)
25 | ------------------
26 |
27 | 1.0.1 (2014-02-27)
28 | ------------------
29 |
--------------------------------------------------------------------------------
/range_sensor_layer/cfg/RangeSensorLayer.cfg:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | PACKAGE = "range_sensor_layer"
3 |
4 | from dynamic_reconfigure.parameter_generator_catkin import *
5 |
6 | gen = ParameterGenerator()
7 |
8 | gen.add('enabled', bool_t, 0, 'Whether to apply this plugin or not', True)
9 | gen.add('phi', double_t, 0, 'Phi value', 1.2)
10 | gen.add('inflate_cone', double_t, 0, 'Inflate the triangular area covered by the sensor (percentage)', 1, 0, 1)
11 | gen.add('no_readings_timeout', double_t, 0, 'No Readings Timeout', 0.0, 0.0)
12 | gen.add('clear_threshold', double_t, 0, 'Probability below which cells are marked as free', 0.2, 0.0, 1.0)
13 | gen.add('mark_threshold', double_t, 0, 'Probability above which cells are marked as occupied', 0.8, 0.0, 1.0)
14 | gen.add('clear_on_max_reading', bool_t, 0, 'Clear on max reading', False)
15 |
16 | exit(gen.generate(PACKAGE, PACKAGE, "RangeSensorLayer"))
17 |
--------------------------------------------------------------------------------
/social_navigation_layers/cfg/ProxemicLayer.cfg:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | PACKAGE='social_navigation_layers'
4 |
5 | import sys
6 | from dynamic_reconfigure.parameter_generator_catkin import *
7 |
8 | gen = ParameterGenerator()
9 |
10 | gen.add("enabled", bool_t, 0, "Whether to apply this plugin or not ", True)
11 | gen.add("cutoff", double_t, 0, "Smallest value to publish on costmap adjustments", 10.0, 1.0, 254.0)
12 | gen.add("amplitude", double_t, 0, "Amplitude of adjustments at peak", 77.0, 0.0, 254.0)
13 | gen.add("covariance", double_t, 0, "Covariance of adjustments", 0.25, 0.0, 5.0)
14 | gen.add("factor", double_t, 0, "Factor with which to scale the velocity", 5.0, 0.0, 20.0)
15 | gen.add("keep_time", double_t, 0, "Pause before clearing leg list", 0.75, 0.0, 2.0)
16 | exit(gen.generate(PACKAGE, "social_navigation_layers", "ProxemicLayer"))
17 |
--------------------------------------------------------------------------------
/range_sensor_layer/package.xml:
--------------------------------------------------------------------------------
1 |
2 | range_sensor_layer
3 | 0.5.0
4 |
5 | Navigation Layer for Range sensors like sonar and IR
6 |
7 |
8 | David V. Lu!!
9 | David!!
10 |
11 | BSD
12 |
13 | http://wiki.ros.org/range_sensor_layer
14 |
15 | catkin
16 | angles
17 | costmap_2d
18 | dynamic_reconfigure
19 | geometry_msgs
20 | pluginlib
21 | roscpp
22 | rospy
23 | sensor_msgs
24 | tf2_geometry_msgs
25 | roslint
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/social_navigation_layers/package.xml:
--------------------------------------------------------------------------------
1 |
2 | social_navigation_layers
3 | 0.5.0
4 |
5 | Plugin-based layers for the navigation stack that
6 | implement various social navigation contraints, like proxemic distance.
7 |
8 | David V. Lu!!
9 | David V. Lu!!
10 | BSD
11 | http://ros.org/wiki/social_navigation_layers
12 |
13 | catkin
14 | angles
15 | costmap_2d
16 | dynamic_reconfigure
17 | geometry_msgs
18 | people_msgs
19 | pluginlib
20 | roscpp
21 | roslint
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/range_sensor_layer/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package range_sensor_layer
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 0.4.0 (2018-08-31)
6 | ------------------
7 | * Clean up with roscompile
8 | * range sensor layer: Remove parameter max_angle (`#38 `_)
9 | Any value set for max_angle gets overwritten in updateCostmap() so the
10 | parameter can safely be removed.
11 | * Issue `#22 `_: on updateCostmap, only touch cells within the triangular projection of the sensor cone. I also add a parameter to regulate (and deactivate) this feature (`#30 `_)
12 | * Add buffer clearing when calling deactivate() or activate(). (`#33 `_)
13 | * Contributors: David V. Lu, Jorge Santos Simón, Krit Chaiso, nxdefiant
14 |
15 | 0.2.4 (2014-12-10)
16 | ------------------
17 |
18 | 0.2.3 (2014-12-10)
19 | ------------------
20 |
--------------------------------------------------------------------------------
/social_navigation_layers/include/social_navigation_layers/proxemic_layer.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 David V. Lu!!
2 | #ifndef SOCIAL_NAVIGATION_LAYERS_PROXEMIC_LAYER_H
3 | #define SOCIAL_NAVIGATION_LAYERS_PROXEMIC_LAYER_H
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | double gaussian(double x, double y, double x0, double y0, double A, double varx, double vary, double skew);
10 | double get_radius(double cutoff, double A, double var);
11 |
12 | namespace social_navigation_layers
13 | {
14 | class ProxemicLayer : public SocialLayer
15 | {
16 | public:
17 | ProxemicLayer()
18 | {
19 | layered_costmap_ = NULL;
20 | }
21 |
22 | virtual void onInitialize();
23 | virtual void updateBoundsFromPeople(double* min_x, double* min_y, double* max_x, double* max_y);
24 | virtual void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
25 |
26 | protected:
27 | void configure(ProxemicLayerConfig &config, uint32_t level);
28 | double cutoff_, amplitude_, covar_, factor_;
29 | dynamic_reconfigure::Server* server_;
30 | dynamic_reconfigure::Server::CallbackType f_;
31 | };
32 | } // namespace social_navigation_layers
33 |
34 | #endif // SOCIAL_NAVIGATION_LAYERS_PROXEMIC_LAYER_H
35 |
--------------------------------------------------------------------------------
/social_navigation_layers/include/social_navigation_layers/social_layer.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 David V. Lu!!
2 | #ifndef SOCIAL_NAVIGATION_LAYERS_SOCIAL_LAYER_H
3 | #define SOCIAL_NAVIGATION_LAYERS_SOCIAL_LAYER_H
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | namespace social_navigation_layers
12 | {
13 | class SocialLayer : public costmap_2d::Layer
14 | {
15 | public:
16 | SocialLayer()
17 | {
18 | layered_costmap_ = NULL;
19 | }
20 |
21 | virtual void onInitialize();
22 | virtual void updateBounds(double origin_x, double origin_y, double origin_yaw, double* min_x, double* min_y,
23 | double* max_x, double* max_y);
24 | virtual void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) = 0;
25 |
26 | virtual void updateBoundsFromPeople(double* min_x, double* min_y, double* max_x, double* max_y) = 0;
27 |
28 | bool isDiscretized()
29 | {
30 | return false;
31 | }
32 |
33 | protected:
34 | void peopleCallback(const people_msgs::People& people);
35 | ros::Subscriber people_sub_;
36 | people_msgs::People people_list_;
37 | std::list transformed_people_;
38 | ros::Duration people_keep_time_;
39 | boost::recursive_mutex lock_;
40 | bool first_time_;
41 | double last_min_x_, last_min_y_, last_max_x_, last_max_y_;
42 | };
43 | } // namespace social_navigation_layers
44 |
45 | #endif // SOCIAL_NAVIGATION_LAYERS_SOCIAL_LAYER_H
46 |
--------------------------------------------------------------------------------
/social_navigation_layers/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(social_navigation_layers)
3 | set_directory_properties(PROPERTIES COMPILE_OPTIONS "-Wall;-Werror")
4 |
5 | find_package(catkin REQUIRED COMPONENTS
6 | angles
7 | costmap_2d
8 | dynamic_reconfigure
9 | geometry_msgs
10 | people_msgs
11 | pluginlib
12 | roscpp
13 | )
14 |
15 | generate_dynamic_reconfigure_options(
16 | cfg/ProxemicLayer.cfg
17 | )
18 |
19 | catkin_package(
20 | CATKIN_DEPENDS angles costmap_2d dynamic_reconfigure geometry_msgs people_msgs pluginlib roscpp
21 | INCLUDE_DIRS include
22 | LIBRARIES social_layers
23 | )
24 |
25 | include_directories(
26 | include ${catkin_INCLUDE_DIRS}
27 | )
28 |
29 | ## add cpp library
30 | add_library(social_layers
31 | src/social_layer.cpp
32 | src/proxemic_layer.cpp
33 | src/passing_layer.cpp
34 | )
35 | add_dependencies(social_layers ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
36 | target_link_libraries(
37 | social_layers ${catkin_LIBRARIES}
38 | )
39 |
40 | if(CATKIN_ENABLE_TESTING)
41 | find_package(catkin REQUIRED COMPONENTS roslint)
42 | roslint_cpp()
43 | roslint_add_test()
44 | endif()
45 |
46 | install(FILES costmap_plugins.xml
47 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
48 | )
49 |
50 | install(TARGETS social_layers
51 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
52 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
53 | RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
54 | )
55 |
56 | install(
57 | DIRECTORY include/${PROJECT_NAME}/
58 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
59 | )
60 |
--------------------------------------------------------------------------------
/range_sensor_layer/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(range_sensor_layer)
3 | set_directory_properties(PROPERTIES COMPILE_OPTIONS "-Wall;-Werror")
4 |
5 | find_package(catkin REQUIRED COMPONENTS
6 | angles
7 | costmap_2d
8 | dynamic_reconfigure
9 | geometry_msgs
10 | pluginlib
11 | roscpp
12 | rospy
13 | sensor_msgs
14 | tf2_geometry_msgs
15 | )
16 |
17 | generate_dynamic_reconfigure_options(cfg/RangeSensorLayer.cfg)
18 |
19 | catkin_package(
20 | CATKIN_DEPENDS
21 | angles
22 | costmap_2d
23 | dynamic_reconfigure
24 | geometry_msgs
25 | pluginlib
26 | roscpp
27 | rospy
28 | sensor_msgs
29 | tf2_geometry_msgs
30 | INCLUDE_DIRS include
31 | LIBRARIES ${PROJECT_NAME}
32 | )
33 |
34 | include_directories(include ${catkin_INCLUDE_DIRS})
35 |
36 | add_library(${PROJECT_NAME} src/range_sensor_layer.cpp)
37 | add_dependencies(${PROJECT_NAME} ${range_sensor_layer_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
38 | target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
39 |
40 | if(CATKIN_ENABLE_TESTING)
41 | find_package(catkin REQUIRED COMPONENTS roslint)
42 | roslint_cpp()
43 | roslint_add_test()
44 | endif()
45 |
46 | install(TARGETS ${PROJECT_NAME}
47 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
48 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
49 | RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
50 | )
51 |
52 | install(FILES costmap_plugins.xml
53 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
54 | )
55 |
56 | install(DIRECTORY include/${PROJECT_NAME}/
57 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
58 | )
59 | catkin_install_python(PROGRAMS scripts/send_message.py
60 | DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
61 | )
62 |
--------------------------------------------------------------------------------
/social_navigation_layers/src/social_layer.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2018 David V. Lu!!
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | using costmap_2d::NO_INFORMATION;
12 | using costmap_2d::LETHAL_OBSTACLE;
13 | using costmap_2d::FREE_SPACE;
14 |
15 | namespace social_navigation_layers
16 | {
17 | void SocialLayer::onInitialize()
18 | {
19 | ros::NodeHandle nh("~/" + name_), g_nh;
20 | current_ = true;
21 | first_time_ = true;
22 | people_sub_ = nh.subscribe("/people", 1, &SocialLayer::peopleCallback, this);
23 | }
24 |
25 | void SocialLayer::peopleCallback(const people_msgs::People& people)
26 | {
27 | boost::recursive_mutex::scoped_lock lock(lock_);
28 | people_list_ = people;
29 | }
30 |
31 |
32 | void SocialLayer::updateBounds(double origin_x, double origin_y, double origin_z, double* min_x, double* min_y,
33 | double* max_x, double* max_y)
34 | {
35 | boost::recursive_mutex::scoped_lock lock(lock_);
36 |
37 | std::string global_frame = layered_costmap_->getGlobalFrameID();
38 | transformed_people_.clear();
39 |
40 | for (unsigned int i = 0; i < people_list_.people.size(); i++)
41 | {
42 | people_msgs::Person& person = people_list_.people[i];
43 | people_msgs::Person tpt;
44 | geometry_msgs::PointStamped pt, opt;
45 |
46 | try
47 | {
48 | pt.point.x = person.position.x;
49 | pt.point.y = person.position.y;
50 | pt.point.z = person.position.z;
51 | pt.header.frame_id = people_list_.header.frame_id;
52 | pt.header.stamp = people_list_.header.stamp;
53 | tf_->transform(pt, opt, global_frame);
54 | tpt.position.x = opt.point.x;
55 | tpt.position.y = opt.point.y;
56 | tpt.position.z = opt.point.z;
57 |
58 | pt.point.x += person.velocity.x;
59 | pt.point.y += person.velocity.y;
60 | pt.point.z += person.velocity.z;
61 | tf_->transform(pt, opt, global_frame);
62 |
63 | tpt.velocity.x = opt.point.x - tpt.position.x;
64 | tpt.velocity.y = opt.point.y - tpt.position.y;
65 | tpt.velocity.z = opt.point.z - tpt.position.z;
66 |
67 | transformed_people_.push_back(tpt);
68 | }
69 | catch (tf2::LookupException& ex)
70 | {
71 | ROS_ERROR("No Transform available Error: %s\n", ex.what());
72 | continue;
73 | }
74 | catch (tf2::ConnectivityException& ex)
75 | {
76 | ROS_ERROR("Connectivity Error: %s\n", ex.what());
77 | continue;
78 | }
79 | catch (tf2::ExtrapolationException& ex)
80 | {
81 | ROS_ERROR("Extrapolation Error: %s\n", ex.what());
82 | continue;
83 | }
84 | }
85 | updateBoundsFromPeople(min_x, min_y, max_x, max_y);
86 | if (first_time_)
87 | {
88 | last_min_x_ = *min_x;
89 | last_min_y_ = *min_y;
90 | last_max_x_ = *max_x;
91 | last_max_y_ = *max_y;
92 | first_time_ = false;
93 | }
94 | else
95 | {
96 | double a = *min_x, b = *min_y, c = *max_x, d = *max_y;
97 | *min_x = std::min(last_min_x_, *min_x);
98 | *min_y = std::min(last_min_y_, *min_y);
99 | *max_x = std::max(last_max_x_, *max_x);
100 | *max_y = std::max(last_max_y_, *max_y);
101 | last_min_x_ = a;
102 | last_min_y_ = b;
103 | last_max_x_ = c;
104 | last_max_y_ = d;
105 | }
106 | }
107 | }; // namespace social_navigation_layers
108 |
--------------------------------------------------------------------------------
/range_sensor_layer/include/range_sensor_layer/range_sensor_layer.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 David V. Lu!!
2 | #ifndef RANGE_SENSOR_LAYER_RANGE_SENSOR_LAYER_H_
3 | #define RANGE_SENSOR_LAYER_RANGE_SENSOR_LAYER_H_
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include