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

Updated ROS2 package #78

Open
wants to merge 42 commits into
base: eloquent
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4d75304
Add a pedsim xml to occmap cpp file
ksatyaki Aug 22, 2019
4cf381a
init eloquent devel
jginesclavero Mar 4, 2020
4283ece
pedsim_msgs to ros2
jginesclavero Mar 4, 2020
3054641
Rm unussed msg
jginesclavero Mar 4, 2020
f8f10d8
pedsim_simulator migrated to ROS2 without visualization
jginesclavero Mar 27, 2020
fb7c9f3
Add parameters to control the radius of the robot and the agents
jginesclavero Mar 31, 2020
7725cd2
Update .gitignore
jginesclavero Mar 31, 2020
b212183
Fixed gazebo's 3D model shaking problem. (#52)
takanotume24 Apr 28, 2020
c5469c5
Fix gazebo model direction (#56)
takanotume24 May 15, 2020
28d930a
Restore kbd and rqt teleop to defalt launch files
makokal Jun 6, 2020
0bce71a
Update obstacle offsets
makokal Jun 8, 2020
10a9aa8
Merge branch 'master' of github.com:srl-freiburg/pedsim_ros
makokal Jun 8, 2020
ad0ab8e
Add node to spawn a single agent
jginesclavero Jul 16, 2020
45e52e6
creating a domestic scenario
jginesclavero Jul 16, 2020
2f4d470
tf2 broadcaster
jginesclavero Jul 16, 2020
9738b90
rm log
jginesclavero Jul 16, 2020
4d71394
pull from srl
ksatyaki Jul 22, 2020
7f557b1
Check NaN values
jginesclavero Aug 12, 2020
0f7c752
Add demo files
jginesclavero Aug 12, 2020
5365226
Migrate pedsim_visualizer to ROS2
jginesclavero Aug 13, 2020
66e5132
Add house demo launch
jginesclavero Aug 13, 2020
1ac7e81
Migrate pedsim_msgs to spencer_msgs in pedsim_visualizer_node
jginesclavero Aug 18, 2020
5019ec1
Update .gitmodules
jginesclavero Aug 18, 2020
e8ea988
Update .gitmodules
jginesclavero Aug 18, 2020
436f3da
Add wall_resolution param wall published once
jginesclavero Aug 18, 2020
d36191d
Update .gitmodules
jginesclavero Aug 19, 2020
1b0e9b1
Add crowd scenario
jginesclavero Nov 18, 2020
4b56c09
Merge branch 'eloquent-dev' of https://github.com/jginesclavero/pedsi…
jginesclavero Nov 18, 2020
3958b0b
Merge with ROS2
ksatyaki Apr 21, 2022
0908d2c
Stuff
ksatyaki Apr 21, 2022
fd1d05b
Optimize imports
ksatyaki Apr 21, 2022
5d00cec
Clang-format everything
ksatyaki Apr 21, 2022
a617435
Add back the gitmodules
ksatyaki Apr 21, 2022
18e684f
Fix
ksatyaki Apr 21, 2022
7527b12
Add back proper submodules
ksatyaki Apr 21, 2022
b7746dd
Update branch for submodules
ksatyaki Apr 21, 2022
2f1e444
Make previous packs work
ksatyaki Apr 21, 2022
e238f5d
More
ksatyaki Apr 27, 2022
48e21f6
Add cubicles
ksatyaki Apr 27, 2022
9d4f96b
Update the branches necessary
ksatyaki Apr 28, 2022
7192b9f
Remove spencer dependencies and integrate rviz plugin into main repo
ksatyaki Apr 28, 2022
e9c477c
Fixes
ksatyaki Apr 28, 2022
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ build
*~
\#*#
.\#*

.vscode/
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "2ndparty/spencer_messages"]
path = 2ndparty/spencer_messages
url = https://github.com/spencer-project/spencer_messages.git
[submodule "2ndparty/spencer_tracking_rviz_plugin"]
path = 2ndparty/spencer_tracking_rviz_plugin
url = https://github.com/srl-freiburg/spencer_tracking_rviz_plugin.git
1 change: 0 additions & 1 deletion 2ndparty/spencer_messages
Submodule spencer_messages deleted from 3b392e
1 change: 0 additions & 1 deletion 2ndparty/spencer_tracking_rviz_plugin
Submodule spencer_tracking_rviz_plugin deleted from 9433aa
1 change: 0 additions & 1 deletion 3rdparty/CMakeLists.txt

This file was deleted.

39 changes: 25 additions & 14 deletions 3rdparty/libpedsim/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(pedsim)

#------------------ Configuration ------------------#
Expand All @@ -15,27 +15,21 @@ if(SHALL_DEBUG)
message("Debugging activated")
add_definitions(-O0 -DDEBUG -ggdb -g3 -rdynamic)
else(SHALL_DEBUG)
message("Debugging deactivated")
# message("Debugging deactivated")
add_definitions(-Os)
endif(SHALL_DEBUG)


find_package(catkin REQUIRED COMPONENTS
roscpp
)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)

find_package(Boost REQUIRED)

catkin_package(
CATKIN_DEPENDS roscpp
INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include/
LIBRARIES pedsim
set(dependencies
rclcpp
)

include_directories(
${catkin_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include/pedsim/
${roscpp_INCLUDE_DIRS}
)
include_directories(include)

set(SOURCES
src/ped_agent.cpp
Expand All @@ -52,3 +46,20 @@ add_library(pedsim ${SOURCES})
target_link_libraries(pedsim
${BOOST_LIBRARIES}
)

install(DIRECTORY include/
DESTINATION include/
)

install(TARGETS
pedsim
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

ament_export_include_directories(include)
ament_export_libraries(pedsim)
ament_export_dependencies(${dependencies})
ament_package()

2 changes: 1 addition & 1 deletion 3rdparty/libpedsim/include/pedsim/ped_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define LIBEXPORT
#endif

#include "ped_vector.h"
#include "pedsim/ped_vector.h"

#include <deque>
#include <set>
Expand Down
8 changes: 4 additions & 4 deletions 3rdparty/libpedsim/include/pedsim/ped_includes.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef _ped_includes_h_
#define _ped_includes_h_ 1

#include "ped_agent.h"
#include "ped_obstacle.h"
#include "ped_scene.h"
#include "ped_waypoint.h"
#include "pedsim/ped_agent.h"
#include "pedsim/ped_obstacle.h"
#include "pedsim/ped_scene.h"
#include "pedsim/ped_waypoint.h"

namespace Ped {
const double LIBEXPORT LIBPEDSIM_VERSION = 2.2;
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/libpedsim/include/pedsim/ped_obstacle.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define LIBEXPORT
#endif

#include "ped_vector.h"
#include "pedsim/ped_vector.h"

namespace Ped {

Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/libpedsim/include/pedsim/ped_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#endif

#include <cmath>
#include "ped_angle.h"
#include "pedsim/ped_angle.h"

namespace Ped {
/// Vector helper class. This is basically a struct with some related functions
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/libpedsim/include/pedsim/ped_waypoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#endif

#include <cstddef>
#include "ped_vector.h"
#include "pedsim/ped_vector.h"

using namespace std;

Expand Down
10 changes: 6 additions & 4 deletions 3rdparty/libpedsim/package.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?xml version="1.0"?>
<package>
<package format ="3">
<name>pedsim</name>
<version>0.2.0</version>
<description>The pedsim package</description>
<maintainer email="[email protected]">Billy Okal</maintainer>
<maintainer email="[email protected]">Luigi Palmieri</maintainer>
<license>BSD</license>

<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>

<run_depend>roscpp</run_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
37 changes: 21 additions & 16 deletions 3rdparty/libpedsim/src/ped_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// Copyright (c) 2003 - 20012 by Christian Gloor
//

#include "ped_agent.h"
#include "ped_obstacle.h"
#include "ped_scene.h"
#include "ped_waypoint.h"
#include "pedsim/ped_agent.h"
#include "pedsim/ped_obstacle.h"
#include "pedsim/ped_scene.h"
#include "pedsim/ped_waypoint.h"

#include <algorithm>
#include <cmath>
Expand Down Expand Up @@ -52,12 +52,13 @@ Ped::Tagent::~Tagent() {}
/// \warning Bad things will happen if the agent is not assigned to a scene. But
/// usually, Tscene takes care of that.
/// \param *s A valid Tscene initialized earlier.
void Ped::Tagent::assignScene(Ped::Tscene* sceneIn) { scene = sceneIn; }
void Ped::Tagent::assignScene(Ped::Tscene *sceneIn) { scene = sceneIn; }

void Ped::Tagent::removeAgentFromNeighbors(const Ped::Tagent* agentIn) {
void Ped::Tagent::removeAgentFromNeighbors(const Ped::Tagent *agentIn) {
// search agent in neighbors, and remove him
set<const Ped::Tagent*>::iterator foundNeighbor = neighbors.find(agentIn);
if (foundNeighbor != neighbors.end()) neighbors.erase(foundNeighbor);
set<const Ped::Tagent *>::iterator foundNeighbor = neighbors.find(agentIn);
if (foundNeighbor != neighbors.end())
neighbors.erase(foundNeighbor);
}

/// Sets the maximum velocity of an agent (vmax). Even if pushed by other
Expand Down Expand Up @@ -99,7 +100,7 @@ void Ped::Tagent::setForceFactorObstacle(double f) { forceFactorObstacle = f; }
/// \return Tvector: the calculated force
Ped::Tvector Ped::Tagent::desiredForce() {
// get destination
Twaypoint* waypoint = getCurrentWaypoint();
Twaypoint *waypoint = getCurrentWaypoint();

// if there is no destination, don't move
if (waypoint == NULL) {
Expand Down Expand Up @@ -140,9 +141,10 @@ Ped::Tvector Ped::Tagent::socialForce() const {
const double n_prime = 3;

Tvector force;
for (const Ped::Tagent* other : neighbors) {
for (const Ped::Tagent *other : neighbors) {
// don't compute social force to yourself
if (other->id == id) continue;
if (other->id == id)
continue;

// compute difference between both agents' positions
Tvector diff = other->p - p;
Expand Down Expand Up @@ -193,10 +195,10 @@ Ped::Tvector Ped::Tagent::obstacleForce() const {
Ped::Tvector minDiff;
double minDistanceSquared = INFINITY;

for (const Tobstacle* obstacle : scene->obstacles) {
for (const Tobstacle *obstacle : scene->obstacles) {
Ped::Tvector closestPoint = obstacle->closestPoint(p);
Ped::Tvector diff = p - closestPoint;
double distanceSquared = diff.lengthSquared(); // use squared distance to
double distanceSquared = diff.lengthSquared(); // use squared distance to
// avoid computing square
// root
if (distanceSquared < minDistanceSquared) {
Expand Down Expand Up @@ -229,8 +231,10 @@ void Ped::Tagent::computeForces() {

// update forces
desiredforce = desiredForce();
if (forceFactorSocial > 0) socialforce = socialForce();
if (forceFactorObstacle > 0) obstacleforce = obstacleForce();
if (forceFactorSocial > 0)
socialforce = socialForce();
if (forceFactorObstacle > 0)
obstacleforce = obstacleForce();
myforce = myForce(desiredDirection);
}

Expand All @@ -253,7 +257,8 @@ void Ped::Tagent::move(double stepSizeIn) {

// don't exceed maximal speed
double speed = v.length();
if (speed > vmax) v = v.normalized() * vmax;
if (speed > vmax)
v = v.normalized() * vmax;

// internal position update = actual move
p += stepSizeIn * v;
Expand Down
14 changes: 7 additions & 7 deletions 3rdparty/libpedsim/src/ped_angle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
// Copyright (c) 2003 - 2012 by Christian Gloor
//

#include "ped_angle.h"
#include "pedsim/ped_angle.h"

bool Ped::Tangle::operator==(const Ped::Tangle& otherIn) const {
bool Ped::Tangle::operator==(const Ped::Tangle &otherIn) const {
return value == otherIn.value;
}

bool Ped::Tangle::operator!=(const Ped::Tangle& otherIn) const {
bool Ped::Tangle::operator!=(const Ped::Tangle &otherIn) const {
return value != otherIn.value;
}

bool Ped::Tangle::operator<(const Ped::Tangle& otherIn) const {
bool Ped::Tangle::operator<(const Ped::Tangle &otherIn) const {
return value < otherIn.value;
}

bool Ped::Tangle::operator<=(const Ped::Tangle& otherIn) const {
bool Ped::Tangle::operator<=(const Ped::Tangle &otherIn) const {
return value <= otherIn.value;
}

bool Ped::Tangle::operator>(const Ped::Tangle& otherIn) const {
bool Ped::Tangle::operator>(const Ped::Tangle &otherIn) const {
return value > otherIn.value;
}

bool Ped::Tangle::operator>=(const Ped::Tangle& otherIn) const {
bool Ped::Tangle::operator>=(const Ped::Tangle &otherIn) const {
return value >= otherIn.value;
}
16 changes: 8 additions & 8 deletions 3rdparty/libpedsim/src/ped_obstacle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Copyright (c) 2003 - 2012 by Christian Gloor
//

#include "ped_obstacle.h"
#include "pedsim/ped_obstacle.h"

#include <cmath>
#include <vector>
Expand Down Expand Up @@ -42,7 +42,7 @@ Ped::Tobstacle::Tobstacle(double pax, double pay, double pbx, double pby) {
/// \date 2013-08-02
/// \param startIn The first corner of the obstacle.
/// \param endIn The second corner of the obstacle.
Ped::Tobstacle::Tobstacle(const Tvector& startIn, const Tvector& endIn) {
Ped::Tobstacle::Tobstacle(const Tvector &startIn, const Tvector &endIn) {
id = staticid++;
ax = startIn.x;
ay = startIn.y;
Expand Down Expand Up @@ -75,21 +75,21 @@ void Ped::Tobstacle::setPosition(double pax, double pay, double pbx,
by = pby;
}

void Ped::Tobstacle::setPosition(const Tvector& startIn, const Tvector& endIn) {
void Ped::Tobstacle::setPosition(const Tvector &startIn, const Tvector &endIn) {
setPosition(startIn.x, startIn.y, endIn.x, endIn.y);
}

void Ped::Tobstacle::setStartPoint(const Tvector& startIn) {
void Ped::Tobstacle::setStartPoint(const Tvector &startIn) {
ax = startIn.x;
ay = startIn.y;
}

void Ped::Tobstacle::setEndPoint(const Tvector& endIn) {
void Ped::Tobstacle::setEndPoint(const Tvector &endIn) {
bx = endIn.x;
by = endIn.y;
}

Ped::Tvector Ped::Tobstacle::closestPoint(const Tvector& pointIn) const {
Ped::Tvector Ped::Tobstacle::closestPoint(const Tvector &pointIn) const {
Tvector startPoint(ax, ay);
Tvector endPoint(bx, by);
Tvector relativeEndPoint = endPoint - startPoint;
Expand Down Expand Up @@ -124,8 +124,8 @@ Ped::Tvector Ped::Tobstacle::closestPoint(double p1, double p2) const {
/// \param rotationCenterIn The point the obstacle will be rotated around.
/// \param angleIn The angle the obstacle will be rotated, where phi is given
/// in radians
void Ped::Tobstacle::rotate(const Ped::Tvector& rotationCenterIn,
const Ped::Tangle& angleIn) {
void Ped::Tobstacle::rotate(const Ped::Tvector &rotationCenterIn,
const Ped::Tangle &angleIn) {
double angleValue = angleIn.toRadian();
double sinPhi = sin(angleValue);
double cosPhi = cos(angleValue);
Expand Down
Loading