From bc21b37429525133dda93b7c0c9bcedd3cf57583 Mon Sep 17 00:00:00 2001 From: Daniel Dugas Date: Fri, 7 Aug 2020 17:31:33 +0200 Subject: [PATCH 1/6] fix memory leak --- src/rvo2.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rvo2.pyx b/src/rvo2.pyx index dcbdded..be04689 100644 --- a/src/rvo2.pyx +++ b/src/rvo2.pyx @@ -87,6 +87,9 @@ cdef class PyRVOSimulator: timeHorizon, timeHorizonObst, radius, maxSpeed, c_velocity) + def __dealloc__(self): + del self.thisptr + def addAgent(self, tuple pos, neighborDist=None, maxNeighbors=None, timeHorizon=None, timeHorizonObst=None, radius=None, maxSpeed=None, From db0043c1216cc806bcf18b8bb03acb5ddf1f9ba9 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 11 Aug 2020 14:00:13 +0200 Subject: [PATCH 2/6] adds test for rvo2 --- test/positions_log_for_test_scenario.npz | Bin 0 -> 1560 bytes test/reproduce_a_scenario.py | 44 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 test/positions_log_for_test_scenario.npz create mode 100644 test/reproduce_a_scenario.py diff --git a/test/positions_log_for_test_scenario.npz b/test/positions_log_for_test_scenario.npz new file mode 100644 index 0000000000000000000000000000000000000000..3e51694a272fe356d8728ae83cec48d6db1cfbd8 GIT binary patch literal 1560 zcmbW1Pe>F|9LL{ecJP$6UApwTI0}oH7(^tFmk^e85eiDk*>pB7+1X}9Fi~a^5fM?_ zND6`xH1X7*L(wIsymg46YljJxPSHUSJY>!9H}66G@^|qK!*{-)H=mjJE-#;}Ii3;e zI45p4{9X@gg@C(WWJKBZhewCqlHWh#-f1qC#|?23CqaOhU{t%WUCrMx#F&^c2OWRF zGcQT=a`B>>m1fcPM!iC*-}MF^;8zMGzLRi&s8Dv2-q_lbm2Fws+LV=(@<^jDSwe8V zt+(T!jCb~a9o9J>cxP_o`zphopQ%qe$E~x*J@9pkKilZj&T+f_$9?d1hUdSbPdmr0 zV&@qCU+3i4^#8OoTr@8}0AFYH{S*4Mv;6IsDexne;jNG8)6Q}0)N}>cuQJ+wm#&|5 zj$5BsrqNd!hp$qfbe2DRJ_CNNGITc4r=8=X`eGJ*ol)m1`m}T0e*bz7e4X;b6ZC24 zxYhD<9`~=(?pRLuPddlt{>B3MIxTw+ecCxLnw~D={#6Dm74$XNT_@#YXln_5mGSm? z>XXj#=-|yV_&Q~mhd%8b595u8;Omqh?xIgS$L-UPtKjPldIr#^o#ktlN8kr4#cm(^ mv>(dzIpbKShC9TQuc{Fk@bKS}p3l{ufC(eHU=3S%tp5dQ Date: Tue, 11 Aug 2020 14:16:46 +0200 Subject: [PATCH 3/6] improve test scenario --- test/positions_log_for_test_scenario.npz | Bin 1560 -> 13378 bytes test/reproduce_a_scenario.py | 39 ++++++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/test/positions_log_for_test_scenario.npz b/test/positions_log_for_test_scenario.npz index 3e51694a272fe356d8728ae83cec48d6db1cfbd8..7607af36878e62b541d1429d6574e2d650758c54 100644 GIT binary patch literal 13378 zcmbu`2UJ!^*Dvs~D{5@m+o(}Y#BS`!B$}us_O3CGHBos5MdNEf*4TTEZB* zU#*-5jM4wam@D)3@f$vNxX&oR0p32p*BRwIAqOjp7YR@heXZ!&qeJIDIoO|UlG~7> zeuKxjHRowF++yZ_)i19{f1_b`~5M{cW8FMW`lb5+<7B+ z-ryT|K864Pe7VpZzKcl@$!^4lb76?T3mPjkLdG9=WP2$Jbca$h?C3IbBbrXX4pL0E&QD=&nb>&jkf-ac=$5u);0g< z8O7^meGo@2e9h0#D9#kBZ2cGU@O75KtAzgW;zm8hQ42r5FTCcLF%SMlJbasm@M6KK zrxdS7=7*;i{(R6=ic^gySpP*leBWEhYZ{h^7kv%lsD&?C0^Vs?!}>4c;eE%$JNG7} zA%4?w>$6+*hxnvXoc#3$*1^Asho4gxp3lDhgyLC~W$@I(AG!2|;)Jhb{TK1@8-g)! zUAqaqsWt+hTKJqb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(WWJKBZhewCqlHWh#-f1qC#|?23CqaOhU{t%WUCrMx#F&^c2OWRF zGcQT=a`B>>m1fcPM!iC*-}MF^;8zMGzLRi&s8Dv2-q_lbm2Fws+LV=(@<^jDSwe8V zt+(T!jCb~a9o9J>cxP_o`zphopQ%qe$E~x*J@9pkKilZj&T+f_$9?d1hUdSbPdmr0 zV&@qCU+3i4^#8OoTr@8}0AFYH{S*4Mv;6IsDexne;jNG8)6Q}0)N}>cuQJ+wm#&|5 zj$5BsrqNd!hp$qfbe2DRJ_CNNGITc4r=8=X`eGJ*ol)m1`m}T0e*bz7e4X;b6ZC24 zxYhD<9`~=(?pRLuPddlt{>B3MIxTw+ecCxLnw~D={#6Dm74$XNT_@#YXln_5mGSm? z>XXj#=-|yV_&Q~mhd%8b595u8;Omqh?xIgS$L-UPtKjPldIr#^o#ktlN8kr4#cm(^ mv>(dzIpbKShC9TQuc{Fk@bKS}p3l{ufC(eHU=3S%tp5dQ Date: Tue, 11 Aug 2020 16:37:34 +0200 Subject: [PATCH 4/6] adds method clearAgents and corresponding test --- src/RVOSimulator.cpp | 6 +++ src/RVOSimulator.h | 5 +++ src/rvo2.pyx | 3 ++ test/reproduce_a_scenario.py | 73 ++++++++++++++++++++++++++++++++---- 4 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/RVOSimulator.cpp b/src/RVOSimulator.cpp index e5feee4..696a2d5 100644 --- a/src/RVOSimulator.cpp +++ b/src/RVOSimulator.cpp @@ -366,4 +366,10 @@ namespace RVO { { timeStep_ = timeStep; } + + void RVOSimulator::clearAgents() + { + agents_.clear(); + kdTree_->agents_.clear(); + } } diff --git a/src/RVOSimulator.h b/src/RVOSimulator.h index bfe715d..6212472 100644 --- a/src/RVOSimulator.h +++ b/src/RVOSimulator.h @@ -575,6 +575,11 @@ namespace RVO { */ void setTimeStep(float timeStep); + /** + * \brief Clears all agents from the simulator, but retains obstacles. + */ + void clearAgents(); + private: std::vector agents_; Agent *defaultAgent_; diff --git a/src/rvo2.pyx b/src/rvo2.pyx index be04689..7314370 100644 --- a/src/rvo2.pyx +++ b/src/rvo2.pyx @@ -73,6 +73,7 @@ cdef extern from "RVOSimulator.h" namespace "RVO": void setAgentTimeHorizonObst(size_t agentNo, float timeHorizonObst) void setAgentVelocity(size_t agentNo, const Vector2 & velocity) void setTimeStep(float timeStep) + void clearAgents() cdef class PyRVOSimulator: @@ -225,3 +226,5 @@ cdef class PyRVOSimulator: self.thisptr.setAgentVelocity(agent_no, c_velocity) def setTimeStep(self, float time_step): self.thisptr.setTimeStep(time_step) + def clearAgents(self): + self.thisptr.clearAgents() diff --git a/test/reproduce_a_scenario.py b/test/reproduce_a_scenario.py index d0757e0..f877bd9 100644 --- a/test/reproduce_a_scenario.py +++ b/test/reproduce_a_scenario.py @@ -4,11 +4,6 @@ def reproduce_test_scenario(plotting=False): sim = rvo2.PyRVOSimulator(1/60., 1.5, 5, 1.5, 2, 0.4, 2) - a0 = sim.addAgent((-1, -1)) - a1 = sim.addAgent((1, -1)) - a2 = sim.addAgent((1, 1)) - a3 = sim.addAgent((-1, 1), 1.5, 5, 1.5, 2, 0.4, 2, (0, 0)) - obstacles = [ [(0.3, 0.1), (0.1, 0.1), (0.1, -0.1)] ] @@ -16,17 +11,18 @@ def reproduce_test_scenario(plotting=False): sim.addObstacle(obstacle) sim.processObstacles() + a0 = sim.addAgent((-1, -1)) + a1 = sim.addAgent((1, -1)) + a2 = sim.addAgent((1, 1)) + a3 = sim.addAgent((-1, 1), 1.5, 5, 1.5, 2, 0.4, 2, (0, 0)) sim.setAgentPrefVelocity(a0, (1, 1)) sim.setAgentPrefVelocity(a1, (-1, 1)) sim.setAgentPrefVelocity(a2, (-1, -1)) sim.setAgentPrefVelocity(a3, (1, -1)) - print('Running simulation') - positions_log = [] for step in range(200): sim.doStep() - positions = [sim.getAgentPosition(agent_no) for agent_no in (a0, a1, a2, a3)] positions_log.append(positions) @@ -50,6 +46,66 @@ def reproduce_test_scenario(plotting=False): print("Test failed!") return test_passed +def test_clear_agents(plotting=False): + sim = rvo2.PyRVOSimulator(1/60., 1.5, 5, 1.5, 2, 0.4, 2) + + obstacles = [ + [(0.3, 0.1), (0.1, 0.1), (0.1, -0.1)] + ] + for obstacle in obstacles: + sim.addObstacle(obstacle) + sim.processObstacles() + + a0 = sim.addAgent((-1, -1)) + a1 = sim.addAgent((1, -1)) + a2 = sim.addAgent((1, 1)) + a3 = sim.addAgent((-1, 1), 1.5, 5, 1.5, 2, 0.4, 2, (0, 0)) + sim.setAgentPrefVelocity(a0, (1, 1)) + sim.setAgentPrefVelocity(a1, (-1, 1)) + sim.setAgentPrefVelocity(a2, (-1, -1)) + sim.setAgentPrefVelocity(a3, (1, -1)) + + positions_log = [] + for step in range(200): + sim.doStep() + positions = [sim.getAgentPosition(agent_no) for agent_no in (a0, a1, a2, a3)] + positions_log.append(positions) + positions_log = np.array(positions_log) + + # clear agents, reset agents, run same scenario + sim.clearAgents() + + a0 = sim.addAgent((-1, -1)) + a1 = sim.addAgent((1, -1)) + a2 = sim.addAgent((1, 1)) + a3 = sim.addAgent((-1, 1), 1.5, 5, 1.5, 2, 0.4, 2, (0, 0)) + sim.setAgentPrefVelocity(a0, (1, 1)) + sim.setAgentPrefVelocity(a1, (-1, 1)) + sim.setAgentPrefVelocity(a2, (-1, -1)) + sim.setAgentPrefVelocity(a3, (1, -1)) + + print('Running simulation') + new_positions_log = [] + for step in range(200): + sim.doStep() + positions = [sim.getAgentPosition(agent_no) for agent_no in (a0, a1, a2, a3)] + new_positions_log.append(positions) + new_positions_log = np.array(new_positions_log) + + test_passed = np.allclose(new_positions_log, positions_log) + + if plotting: + plot_obstacles(np.array(obstacles)) + plot_positions_log(positions_log) + plot_positions_log(new_positions_log) + + if test_passed: + print("Test passed!") + else: + print("Test failed!") + return test_passed + + def plot_positions_log(positions_log): n_traj = positions_log.shape[1] for i in range(n_traj): @@ -64,4 +120,5 @@ def plot_obstacles(obstacles): if __name__ == "__main__": from matplotlib import pyplot as plt reproduce_test_scenario(plotting=True) + test_clear_agents() plt.show() From 1331d210cc62e47627c2fddabee9c500c437b39e Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 12 Aug 2020 12:58:01 +0200 Subject: [PATCH 5/6] fix memory leak from clearAgents --- src/RVOSimulator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/RVOSimulator.cpp b/src/RVOSimulator.cpp index 696a2d5..7844ed4 100644 --- a/src/RVOSimulator.cpp +++ b/src/RVOSimulator.cpp @@ -369,6 +369,9 @@ namespace RVO { void RVOSimulator::clearAgents() { + for (size_t i = 0; i < agents_.size(); ++i) { + delete agents_[i]; + } agents_.clear(); kdTree_->agents_.clear(); } From 0b1c07973dababf212e63eadb9d06b1179b7c0e2 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 20 Aug 2020 11:41:27 +0200 Subject: [PATCH 6/6] numpy cython deps --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index f53ed6f..16e5dfd 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import numpy from setuptools import setup, Extension from setuptools.command.build_ext import build_ext as _build_ext from Cython.Build import cythonize @@ -48,4 +49,5 @@ def run(self): 'Topic :: Games/Entertainment :: Simulation', 'Topic :: Software Development :: Libraries :: Python Modules', ], + include_dirs=[numpy.get_include()], )