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

Modernize and extend capabilities #2

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
589775e
enable compilation with C++17
rayvburn Aug 17, 2024
a21d063
multi-inclusion guard changed to simple `pragma`
rayvburn Aug 17, 2024
46b97b6
`PeopleExtraction` - reworked static literal constants
rayvburn Aug 17, 2024
df7d464
fixed `int` vs `size_t` type mismatches
rayvburn Aug 17, 2024
ffd8cd1
`printf` usage fix
rayvburn Aug 17, 2024
43b1275
node configuration YAML file parameterized in the launch
rayvburn Aug 17, 2024
6fdf5bc
updated contact info
rayvburn Aug 17, 2024
511ad6d
simplified data collection and processing, applied `people_msgs_utils…
rayvburn Aug 17, 2024
42a0be2
added parsing `LinkStates` as for some models the returned poses are …
rayvburn Aug 17, 2024
59d3c0f
parts common for `ModelStates` and `LinkStates` moved to `GazeboExtra…
rayvburn Aug 18, 2024
d8b97cc
the main class extended with the `HuBeRo` agents extractor
rayvburn Aug 18, 2024
1b852d9
added note in the example YAML config
rayvburn Aug 18, 2024
53551bf
added `inline` keyword in the `GazeboExtractor`
rayvburn Aug 18, 2024
e524290
added guards for valid TF frame names
rayvburn Aug 18, 2024
e8ecb75
`GazeboModelExtractor` and `GazeboLinkExtractor` created only when re…
rayvburn Aug 18, 2024
1c42248
unified formatting
rayvburn Aug 18, 2024
bbc5680
additional TFs are set up to be applied for certain model classes in …
rayvburn Aug 18, 2024
8a7f0fc
updated README
rayvburn Aug 18, 2024
425c1d7
`GazeboExtractor` - manual velocity calculation implemented (with sim…
rayvburn Aug 18, 2024
985dfb3
`GazeboExtractor` - `isMatching` protected method transformed into st…
rayvburn Aug 24, 2024
8b4b172
information about people groups (F-formations) included in considerat…
rayvburn Aug 24, 2024
f2bfb3f
`GazeboExtractor` - reworked data processing algorithm in model state…
rayvburn Aug 25, 2024
8004619
added methods to manually start processing callbacks in the `GazeboEx…
rayvburn Aug 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
src/actor_legs_extraction_node.cpp
src/LegsExtraction.*
launch/actor_legs_extraction.launch
config/legs.yaml
config/legs.yaml
build/
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(people_extraction)

find_package(catkin REQUIRED COMPONENTS
gazebo_ros
roscpp
people_msgs
people_msgs_utils
angles
)

catkin_package(
CATKIN_DEPENDS
gazebo_ros
roscpp
people_msgs
people_msgs_utils
angles
)

set(CMAKE_CXX_FLAGS "-Wall -Wpedantic --std=c++14")
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic --std=c++17")
link_directories(${GAZEBO_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

add_library(people_extraction
src/PeopleExtraction.hpp
src/PeopleExtraction.cpp
src/GazeboExtractor.hpp
src/ActorLocalizationSubscriber.hpp
src/HuberoExtractor.hpp
src/HuberoExtractor.cpp
)

target_link_libraries(people_extraction
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# people_extraction
ROS package that searches for certain model names at [`/gazebo/model_states`](http://docs.ros.org/en/kinetic/api/gazebo_msgs/html/msg/ModelStates.html) topic and republishes gathered data as [`people_msgs/People.msg`](http://docs.ros.org/en/api/people_msgs/html/msg/People.html) and [`people_msgs/PositionMeasurementArray.msg`](http://docs.ros.org/en/api/people_msgs/html/msg/PositionMeasurementArray.html) to ROS topics with a given names.

Tested under Ubuntu 16.04 and ROS Kinetic.
ROS package that searches for certain model names at [`/gazebo/model_states`](http://docs.ros.org/en/melodic/api/gazebo_msgs/html/msg/ModelStates.html) and certain link names at [`/gazebo/link_states`](http://docs.ros.org/en/melodic/api/gazebo_msgs/html/msg/LinkStates.html) topics and republishes gathered data as [`people_msgs/People.msg`](http://docs.ros.org/en/api/people_msgs/html/msg/People.html) and [`people_msgs/PositionMeasurementArray.msg`](http://docs.ros.org/en/api/people_msgs/html/msg/PositionMeasurementArray.html) to ROS topics with given names.

Tested under Ubuntu 18.04 and ROS Melodic.
42 changes: 36 additions & 6 deletions config/people.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
gazebo_frame: "world"
target_frame: "map"
callback_omits: 25 # each n-th simulator callback will be processed
# The example configuration fits https://github.com/aws-robotics/aws-robomaker-hospital-world (with some modifications)
model_name_patterns: [
"actor",
]

people_topic: "/people"
position_topic: "/people_measurements"
link_name_patterns: [
"Scrubs",
"PatientWheelChair",
"MaleVisitorSit",
"VisitorKidSit",
"FemaleVisitor",
]

model_name_patterns: ["person", "actor"]
# Additional transforms to be applied for some specific models
transforms:
# the key here must match the "name patterns" above
actor: [
# transform is applied to elements one by one;
# the order of elements is: x, y, z, roll, pitch, yaw
+0.0,
+0.0,
-1.03,
-1.5708,
+0.0,
-1.5708
]

groups:
# define names of groups so they can be read as separate ROS parameters (whole dicts cannot be passed as ROS params)
names: [
"GroupDesk"
]
# specify names of entities (values) involved in each group (keys)
GroupDesk: [
"Scrubs_Group_01",
"Scrubs_Group_02",
"FemaleVisitor_Group_01"
]
22 changes: 20 additions & 2 deletions launch/people_extraction.launch
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
<launch>
<rosparam file="$(find people_extraction)/config/people.yaml" command="load" ns="people_extraction" />
<node name="people_extraction" pkg="people_extraction" type="people_extraction_node" output="screen" ns="people_extraction"/>
<arg name="world_frame" default="world"/>
<arg name="target_frame" default="odom"/>
<arg name="config_file" default="$(find people_extraction)/config/people.yaml"/>

<!-- output topics -->
<arg name="pub_frequency" default="10.0"/>
<arg name="people_topic" default="/people"/>
<arg name="position_topic" default="/people_pos"/>

<arg name="ns" default="people_extraction"/>
<rosparam file="$(arg config_file)" command="load" ns="$(arg ns)" />

<node name="people_extraction" pkg="people_extraction" type="people_extraction_node" output="screen" ns="$(arg ns)">
<remap from="/people" to="$(arg people_topic)"/>
<remap from="/people_measurements" to="$(arg position_topic)"/>
<param name="pub_frequency" value="$(arg pub_frequency)"/>

<param name="world_frame" value="$(arg world_frame)"/>
<param name="target_frame" value="$(arg target_frame)"/>
</node>
</launch>
5 changes: 4 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
<version>1.0.0</version>
<description>people_extraction package</description>

<maintainer email="[email protected]">Jaroslaw Karwowski</maintainer>
<author email="[email protected]">Jarosław Karwowski</author>
<maintainer email="[email protected]">Jarosław Karwowski</maintainer>

<license>GPLv3</license>

<buildtool_depend>catkin</buildtool_depend>
<depend>roscpp</depend>
<depend>gazebo_ros</depend>
<depend>people_msgs</depend>
<depend>people_msgs_utils</depend>
<depend>angles</depend>

</package>
65 changes: 65 additions & 0 deletions src/ActorLocalizationSubscriber.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#pragma once

#include <ros/ros.h>
#include <nav_msgs/Odometry.h>

#include <mutex>
#include <string>

class ActorLocalizationSubscriber {
public:
/**
* @param nh node handle to use
* @param topic topic to subscribe odometry-localization messages
*/
ActorLocalizationSubscriber(
ros::NodeHandle& nh,
const size_t& actor_id,
const std::string& actor_name,
const std::string& topic
):
id_(actor_id),
name_(actor_name),
topic_(topic)
{
sub_ = nh.subscribe<nav_msgs::Odometry>(
topic_,
10,
std::bind(
&ActorLocalizationSubscriber::callback,
this,
std::placeholders::_1
)
);
}

nav_msgs::Odometry getOdom() const {
std::lock_guard<std::mutex> lock(mutex_);
return odom_;
}

size_t getID() const {
return id_;
}

std::string getName() const {
return name_;
}

std::string getTopic() const {
return topic_;
}

protected:
void callback(const nav_msgs::Odometry::ConstPtr& msg) {
std::lock_guard<std::mutex> lock(mutex_);
odom_ = *msg;
}

mutable std::mutex mutex_;
ros::Subscriber sub_;
nav_msgs::Odometry odom_;
size_t id_;
std::string name_;
std::string topic_;
};
Loading