repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
PythonRobotics
tests/test_flow_field.py
.py
import conftest import PathPlanning.FlowField.flowfield as flow_field def test(): flow_field.show_animation = False flow_field.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
210
PythonRobotics
tests/test_rectangle_fitting.py
.py
import conftest # Add root path to sys.path from Mapping.rectangle_fitting import rectangle_fitting as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
229
PythonRobotics
tests/test_rear_wheel_feedback.py
.py
import conftest # Add root path to sys.path from PathTracking.rear_wheel_feedback_control import rear_wheel_feedback_control as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
254
PythonRobotics
tests/test_stanley_controller.py
.py
import conftest # Add root path to sys.path from PathTracking.stanley_control import stanley_control as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
230
PythonRobotics
tests/test_breadth_first_search.py
.py
import conftest from PathPlanning.BreadthFirstSearch import breadth_first_search as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
221
PythonRobotics
tests/test_move_to_pose.py
.py
import itertools import numpy as np import conftest # Add root path to sys.path from PathTracking.move_to_pose import move_to_pose as m def test_random(): m.show_animation = False m.main() def test_stability(): """ This unit test tests the move_to_pose.py program for stability """ m.show_an...
91
2,693
PythonRobotics
tests/test_rrt_star.py
.py
import conftest # Add root path to sys.path from PathPlanning.RRTStar import rrt_star as m def test1(): m.show_animation = False m.main() def test_no_obstacle(): obstacle_list = [] # Set Initial parameters rrt_star = m.RRTStar(start=[0, 0], goal=[6, 10], ...
37
935
PythonRobotics
tests/test_rrt_star_dubins.py
.py
import conftest # Add root path to sys.path from PathPlanning.RRTStarDubins import rrt_star_dubins as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
228
PythonRobotics
tests/test_greedy_best_first_search.py
.py
import conftest from PathPlanning.GreedyBestFirstSearch import greedy_best_first_search as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
228
PythonRobotics
tests/test_potential_field_planning.py
.py
import conftest # Add root path to sys.path from PathPlanning.PotentialFieldPlanning import potential_field_planning as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
246
PythonRobotics
tests/test_dstar.py
.py
import conftest from PathPlanning.DStar import dstar as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
182
PythonRobotics
tests/test_LQR_planner.py
.py
import conftest # Add root path to sys.path from PathPlanning.LQRPlanner import lqr_planner as m def test_1(): m.SHOW_ANIMATION = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
222
PythonRobotics
tests/test_dijkstra.py
.py
import conftest from PathPlanning.Dijkstra import dijkstra as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
188
PythonRobotics
tests/test_visibility_road_map_planner.py
.py
import conftest # Add root path to sys.path from PathPlanning.VoronoiRoadMap import voronoi_road_map as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
230
PythonRobotics
tests/test_gaussian_grid_map.py
.py
import conftest from Mapping.gaussian_grid_map import gaussian_grid_map as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
200
PythonRobotics
tests/test_state_lattice_planner.py
.py
import conftest # Add root path to sys.path from PathPlanning.StateLatticePlanner import state_lattice_planner as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
240
PythonRobotics
tests/test_two_joint_arm_to_point_control.py
.py
import conftest # Add root path to sys.path from ArmNavigation.two_joint_arm_to_point_control \ import two_joint_arm_to_point_control as m def test1(): m.show_animation = False m.animation() if __name__ == '__main__': conftest.run_this_test(__file__)
13
272
PythonRobotics
tests/test_bug.py
.py
import conftest from PathPlanning.BugPlanning import bug as m def test_1(): m.show_animation = False m.main(bug_0=True, bug_1=True, bug_2=True) if __name__ == '__main__': conftest.run_this_test(__file__)
12
220
PythonRobotics
tests/test_codestyle.py
.py
""" Diff code style checker with ruff This code come from: https://github.com/scipy/scipy/blob/main/tools/lint.py Scipy's licence: https://github.com/scipy/scipy/blob/main/LICENSE.txt Copyright (c) 2001-2002 Enthought, Inc. 2003-2022, SciPy Developers. All rights reserved. Redistribution and use in source and binary...
139
4,364
PythonRobotics
tests/test_wavefront_coverage_path_planner.py
.py
import conftest # Add root path to sys.path import os import matplotlib.pyplot as plt from PathPlanning.WavefrontCPP import wavefront_coverage_path_planner wavefront_coverage_path_planner.do_animation = False def wavefront_cpp(img, start, goal): num_free = 0 for i in range(img.shape[0]): for j in ra...
64
1,791
PythonRobotics
tests/test_rocket_powered_landing.py
.py
import conftest # Add root path to sys.path import numpy as np from numpy.testing import suppress_warnings from AerialNavigation.rocket_powered_landing import rocket_powered_landing as m def test1(): m.show_animation = False with suppress_warnings() as sup: sup.filter(UserWarning, ...
21
595
PythonRobotics
tests/test_elastic_bands.py
.py
import conftest import numpy as np from PathPlanning.ElasticBands.elastic_bands import ElasticBands def test_1(): path = np.load("PathPlanning/ElasticBands/path.npy") obstacles_points = np.load("PathPlanning/ElasticBands/obstacles.npy") obstacles = np.zeros((500, 500)) for x, y in obstacles_points: ...
24
788
PythonRobotics
tests/test_particle_swarm_optimization.py
.py
import conftest # Add root path to sys.path from PathPlanning.ParticleSwarmOptimization import particle_swarm_optimization as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
11
252
PythonRobotics
tests/test_particle_filter.py
.py
import conftest # Add root path to sys.path from Localization.particle_filter import particle_filter as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
231
PythonRobotics
tests/test_quintic_polynomials_planner.py
.py
import conftest # Add root path to sys.path from PathPlanning.QuinticPolynomialsPlanner import quintic_polynomials_planner as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
252
PythonRobotics
tests/test_d_star_lite.py
.py
import conftest from PathPlanning.DStarLite import d_star_lite as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
192
PythonRobotics
tests/test_priority_based_planner.py
.py
from PathPlanning.TimeBasedPathPlanning.GridWithDynamicObstacles import ( Grid, NodePath, ObstacleArrangement, Position, ) from PathPlanning.TimeBasedPathPlanning.BaseClasses import StartAndGoal from PathPlanning.TimeBasedPathPlanning import PriorityBasedPlanner as m from PathPlanning.TimeBasedPathPlann...
40
1,400
PythonRobotics
tests/test_rrt.py
.py
import conftest import random from PathPlanning.RRT import rrt as m from PathPlanning.RRT import rrt_with_pathsmoothing as m1 random.seed(12345) def test1(): m.show_animation = False m.main(gx=1.0, gy=1.0) def test2(): m1.show_animation = False m1.main() if __name__ == '__main__': conftest.r...
22
343
PythonRobotics
tests/test_cubature_kalman_filter.py
.py
import conftest from Localization.cubature_kalman_filter import cubature_kalman_filter as m def test1(): m.show_final = False m.show_animation = False m.show_ellipse = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
14
267
PythonRobotics
tests/test_a_star_searching_two_side.py
.py
import conftest from PathPlanning.AStar import a_star_searching_from_two_side as m def test1(): m.show_animation = False m.main(800) def test2(): m.show_animation = False m.main(5000) # increase obstacle number, block path if __name__ == '__main__': conftest.run_this_test(__file__)
17
310
PythonRobotics
tests/test_rrt_star_reeds_shepp.py
.py
import conftest # Add root path to sys.path from PathPlanning.RRTStarReedsShepp import rrt_star_reeds_shepp as m def test1(): m.show_animation = False m.main(max_iter=5) obstacleList = [ (5, 5, 1), (4, 6, 1), (4, 8, 1), (4, 10, 1), (6, 5, 1), (7, 5, 1), (8, 6, 1), (8, 8, 1), ...
47
1,456
PythonRobotics
tests/test_informed_rrt_star.py
.py
import conftest from PathPlanning.InformedRRTStar import informed_rrt_star as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
203
PythonRobotics
tests/test_normal_vector_estimation.py
.py
import conftest # Add root path to sys.path from Mapping.normal_vector_estimation import normal_vector_estimation as m import random random.seed(12345) def test_1(): m.show_animation = False m.main1() def test_2(): m.show_animation = False m.main2() if __name__ == '__main__': conftest.run_th...
20
338
PythonRobotics
tests/test_grid_based_sweep_coverage_path_planner.py
.py
import conftest from PathPlanning.GridBasedSweepCPP \ import grid_based_sweep_coverage_path_planner grid_based_sweep_coverage_path_planner.do_animation = False RIGHT = grid_based_sweep_coverage_path_planner. \ SweepSearcher.MovingDirection.RIGHT LEFT = grid_based_sweep_coverage_path_planner. \ SweepSearche...
119
3,212
PythonRobotics
tests/test_mypy_type_check.py
.py
import os import subprocess import conftest SUBPACKAGE_LIST = [ "AerialNavigation", "ArmNavigation", "Bipedal", "Localization", "Mapping", "PathPlanning", "PathTracking", "SLAM", "InvertedPendulum" ] def run_mypy(dir_name, project_path, config_path): res = subprocess.run( ...
51
1,086
PythonRobotics
tests/test_lqr_speed_steer_control.py
.py
import conftest # Add root path to sys.path from PathTracking.lqr_speed_steer_control import lqr_speed_steer_control as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
247
PythonRobotics
tests/test_n_joint_arm_to_point_control.py
.py
import conftest # Add root path to sys.path from ArmNavigation.n_joint_arm_to_point_control\ import n_joint_arm_to_point_control as m import random random.seed(12345) def test1(): m.show_animation = False m.animation() if __name__ == '__main__': conftest.run_this_test(__file__)
16
301
PythonRobotics
tests/test_point_cloud_sampling.py
.py
import conftest # Add root path to sys.path from Mapping.point_cloud_sampling import point_cloud_sampling as m def test_1(capsys): m.do_plot = False m.main() captured = capsys.readouterr() assert "voxel_sampling_points.shape=(27, 3)" in captured.out assert "farthest_sampling_points.shape=(20, 3)"...
16
466
PythonRobotics
tests/test_voronoi_road_map_planner.py
.py
import conftest # Add root path to sys.path from PathPlanning.VisibilityRoadMap import visibility_road_map as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
236
PythonRobotics
tests/test_clothoidal_paths.py
.py
import conftest from PathPlanning.ClothoidPath import clothoid_path_planner as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
205
PythonRobotics
tests/test_histogram_filter.py
.py
import conftest from Localization.histogram_filter import histogram_filter as m def test1(): m.show_animation = False m.SIM_TIME = 1.0 m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
13
224
PythonRobotics
tests/test_ekf_slam.py
.py
import conftest from SLAM.EKFSLAM import ekf_slam as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
179
PythonRobotics
tests/test_drone_3d_trajectory_following.py
.py
import conftest from AerialNavigation.drone_3d_trajectory_following \ import drone_3d_trajectory_following as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
13
239
PythonRobotics
tests/test_state_machine.py
.py
import conftest from MissionPlanning.StateMachine.state_machine import StateMachine def test_transition(): sm = StateMachine("state_machine") sm.add_transition(src_state="idle", event="start", dst_state="running") sm.set_current_state("idle") sm.process("start") assert sm.get_current_state().name...
52
1,326
PythonRobotics
tests/test_move_to_pose_robot.py
.py
import conftest # Add root path to sys.path from PathTracking.move_to_pose import move_to_pose as m def test_1(): """ This unit test tests the move_to_pose_robot.py program """ m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
15
300
PythonRobotics
tests/test_hybrid_a_star.py
.py
import conftest from PathPlanning.HybridAStar import hybrid_a_star as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
195
PythonRobotics
tests/test_dynamic_window_approach.py
.py
import conftest import numpy as np from PathPlanning.DynamicWindowApproach import dynamic_window_approach as m def test_main1(): m.show_animation = False m.main(gx=1.0, gy=1.0) def test_main2(): m.show_animation = False m.main(gx=1.0, gy=1.0, robot_type=m.RobotType.rectangle) def test_stuck_main(...
49
1,532
PythonRobotics
tests/test_safe_interval_path_planner.py
.py
from PathPlanning.TimeBasedPathPlanning.GridWithDynamicObstacles import ( Grid, ObstacleArrangement, Position, ) from PathPlanning.TimeBasedPathPlanning import SafeInterval as m import numpy as np import conftest def test_1(): start = Position(1, 11) goal = Position(19, 19) grid_side_length = ...
32
766
PythonRobotics
tests/test_reeds_shepp_path_planning.py
.py
import numpy as np import conftest # Add root path to sys.path from PathPlanning.ReedsSheppPath import reeds_shepp_path_planning as m def check_edge_condition(px, py, pyaw, start_x, start_y, start_yaw, end_x, end_y, end_yaw): assert (abs(px[0] - start_x) <= 0.01) assert (abs(py[0] -...
58
1,749
PythonRobotics
tests/test_spiral_spanning_tree_coverage_path_planner.py
.py
import conftest # Add root path to sys.path import os import matplotlib.pyplot as plt from PathPlanning.SpiralSpanningTreeCPP \ import spiral_spanning_tree_coverage_path_planner spiral_spanning_tree_coverage_path_planner.do_animation = True def spiral_stc_cpp(img, start): num_free = 0 for i in range(img...
59
1,609
PythonRobotics
tests/test_a_star.py
.py
import conftest from PathPlanning.AStar import a_star as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
183
PythonRobotics
tests/test_batch_informed_rrt_star.py
.py
import random import conftest from PathPlanning.BatchInformedRRTStar import batch_informed_rrt_star as m def test_1(): m.show_animation = False random.seed(12345) m.main(maxIter=10) if __name__ == '__main__': conftest.run_this_test(__file__)
15
263
PythonRobotics
tests/test_kmeans_clustering.py
.py
import conftest from Mapping.kmeans_clustering import kmeans_clustering as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
201
PythonRobotics
tests/test_rrt_with_pathsmoothing_radius.py
.py
import conftest import math from PathPlanning.RRT import rrt_with_pathsmoothing as rrt_module def test_smoothed_path_safety(): # Define test environment obstacle_list = [ (5, 5, 1.0), (3, 6, 2.0), (3, 8, 2.0), (3, 10, 2.0), (7, 5, 2.0), (9, 5, 2.0) ] rob...
49
1,333
PythonRobotics
tests/test_lqr_steer_control.py
.py
import conftest # Add root path to sys.path from PathTracking.lqr_steer_control import lqr_steer_control as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
234
PythonRobotics
tests/test_iterative_closest_point.py
.py
import conftest from SLAM.ICPMatching import icp_matching as m def test_1(): m.show_animation = False m.main() def test_2(): m.show_animation = False m.main_3d_points() if __name__ == '__main__': conftest.run_this_test(__file__)
17
255
PythonRobotics
tests/test_grid_map_lib.py
.py
from Mapping.grid_map_lib.grid_map_lib import GridMap import conftest import numpy as np def test_position_set(): grid_map = GridMap(100, 120, 0.5, 10.0, -0.5) grid_map.set_value_from_xy_pos(10.1, -1.1, 1.0) grid_map.set_value_from_xy_pos(10.1, -0.1, 1.0) grid_map.set_value_from_xy_pos(10.1, 1.1, 1.0...
41
1,312
PythonRobotics
tests/test_depth_first_search.py
.py
import conftest from PathPlanning.DepthFirstSearch import depth_first_search as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
206
PythonRobotics
tests/test_theta_star.py
.py
import conftest from PathPlanning.ThetaStar import theta_star as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
11
190
PythonRobotics
tests/test_inverted_pendulum_lqr_control.py
.py
import conftest from InvertedPendulum import inverted_pendulum_lqr_control as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
204
PythonRobotics
tests/test_behavior_tree.py
.py
import pytest import conftest from MissionPlanning.BehaviorTree.behavior_tree import ( BehaviorTreeFactory, Status, ActionNode, ) def test_sequence_node1(): xml_string = """ <Sequence> <Echo name="Echo 1" message="Hello, World1!" /> <Echo name="Echo 2" message="Hello, ...
208
6,502
PythonRobotics
tests/test_inverted_pendulum_mpc_control.py
.py
import conftest from InvertedPendulum import inverted_pendulum_mpc_control as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
13
204
PythonRobotics
tests/test_bipedal_planner.py
.py
import conftest from Bipedal.bipedal_planner import bipedal_planner as m def test_1(): bipedal_planner = m.BipedalPlanner() footsteps = [[0.0, 0.2, 0.0], [0.3, 0.2, 0.0], [0.3, 0.2, 0.2], [0.3, 0.2, 0.2], [0.0, 0.2, 0.2]] bipedal_planner...
19
453
PythonRobotics
tests/test_unscented_kalman_filter.py
.py
import conftest # Add root path to sys.path from Localization.unscented_kalman_filter import unscented_kalman_filter as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
246
PythonRobotics
tests/test_distance_map.py
.py
import conftest # noqa import numpy as np from Mapping.DistanceMap import distance_map as m def test_compute_sdf(): """Test the computation of Signed Distance Field (SDF)""" # Create a simple obstacle map for testing obstacles = np.array([[0, 0, 0], [0, 1, 0], [0, 0, 0]]) sdf = m.compute_sdf(obstacl...
119
3,977
PythonRobotics
tests/test_cgmres_nmpc.py
.py
import conftest from PathTracking.cgmres_nmpc import cgmres_nmpc as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
193
PythonRobotics
tests/test_frenet_optimal_trajectory.py
.py
import conftest from PathPlanning.FrenetOptimalTrajectory import frenet_optimal_trajectory as m from PathPlanning.FrenetOptimalTrajectory.frenet_optimal_trajectory import ( LateralMovement, LongitudinalMovement, ) def default_scenario_test(): m.show_animation = False m.SIM_LOOP = 5 m.main() def ...
49
1,336
PythonRobotics
tests/test_fast_slam2.py
.py
import conftest from SLAM.FastSLAM2 import fast_slam2 as m def test1(): m.show_animation = False m.SIM_TIME = 3.0 m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
13
203
PythonRobotics
tests/test_circle_fitting.py
.py
import conftest from Mapping.circle_fitting import circle_fitting as m def test_1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
195
PythonRobotics
tests/test_catmull_rom_spline.py
.py
import conftest from PathPlanning.Catmull_RomSplinePath.catmull_rom_spline_path import catmull_rom_spline def test_catmull_rom_spline(): way_points = [[0, 0], [1, 2], [2, 0], [3, 3]] num_points = 100 spline_x, spline_y = catmull_rom_spline(way_points, num_points) assert spline_x.size > 0, "Spline...
17
600
PythonRobotics
tests/test_fast_slam1.py
.py
import conftest from SLAM.FastSLAM1 import fast_slam1 as m def test1(): m.show_animation = False m.SIM_TIME = 3.0 m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
13
203
PythonRobotics
tests/test_model_predictive_speed_and_steer_control.py
.py
import conftest # Add root path to sys.path from PathTracking.model_predictive_speed_and_steer_control \ import model_predictive_speed_and_steer_control as m def test_1(): m.show_animation = False m.main() def test_2(): m.show_animation = False m.main2() if __name__ == '__main__': confte...
19
347
PythonRobotics
tests/test_rrt_dubins.py
.py
import conftest # Add root path to sys.path from PathPlanning.RRTDubins import rrt_dubins as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
219
PythonRobotics
tests/test_pure_pursuit.py
.py
import conftest # Add root path to sys.path from PathTracking.pure_pursuit import pure_pursuit as m def test1(): m.show_animation = False m.main() def test_backward(): m.show_animation = False m.is_reverse_mode = True m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
16
316
PythonRobotics
tests/test_utils.py
.py
import conftest # Add root path to sys.path from utils import angle from numpy.testing import assert_allclose import numpy as np def test_rot_mat_2d(): assert_allclose(angle.rot_mat_2d(0.0), np.array([[1., 0.], [0., 1.]])) def test_angle_mod(): assert_allcl...
28
815
PythonRobotics
tests/test_dubins_path_planning.py
.py
import numpy as np import conftest from PathPlanning.DubinsPath import dubins_path_planner np.random.seed(12345) def check_edge_condition(px, py, pyaw, start_x, start_y, start_yaw, end_x, end_y, end_yaw): assert (abs(px[0] - start_x) <= 0.01) assert (abs(py[0] - start_y) <= 0.01) ...
93
2,663
PythonRobotics
tests/test_closed_loop_rrt_star_car.py
.py
import conftest from PathPlanning.ClosedLoopRRTStar import closed_loop_rrt_star_car as m import random def test_1(): random.seed(12345) m.show_animation = False m.main(gx=1.0, gy=0.0, gyaw=0.0, max_iter=5) if __name__ == '__main__': conftest.run_this_test(__file__)
14
286
PythonRobotics
tests/test_rrt_with_sobol_sampler.py
.py
import conftest # Add root path to sys.path from PathPlanning.RRT import rrt_with_sobol_sampler as m import random random.seed(12345) def test1(): m.show_animation = False m.main(gx=1.0, gy=1.0) if __name__ == '__main__': conftest.run_this_test(__file__)
15
273
PythonRobotics
tests/test_space_time_astar.py
.py
from PathPlanning.TimeBasedPathPlanning.GridWithDynamicObstacles import ( Grid, ObstacleArrangement, Position, ) from PathPlanning.TimeBasedPathPlanning import SpaceTimeAStar as m import numpy as np import conftest def test_1(): start = Position(1, 11) goal = Position(19, 19) grid_side_length ...
33
802
PythonRobotics
tests/test_ray_casting_grid_map.py
.py
import conftest # Add root path to sys.path from Mapping.ray_casting_grid_map import ray_casting_grid_map as m def test1(): m.show_animation = False m.main() if __name__ == '__main__': conftest.run_this_test(__file__)
12
235
PythonRobotics
tests/conftest.py
.py
"""Path hack to make tests work.""" import sys import os import pytest TEST_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(TEST_DIR) # to import this file from test code. ROOT_DIR = os.path.dirname(TEST_DIR) sys.path.append(ROOT_DIR) def run_this_test(file): pytest.main(args=["-W", "error", "-...
14
379
PythonRobotics
Mapping/kmeans_clustering/kmeans_clustering.py
.py
""" Object clustering with k-means algorithm author: Atsushi Sakai (@Atsushi_twi) """ import math import matplotlib.pyplot as plt import random # k means parameters MAX_LOOP = 10 DCOST_TH = 0.1 show_animation = True def kmeans_clustering(rx, ry, nc): """ Performs k-means clustering on the given dataset, ...
175
4,461
PythonRobotics
Mapping/ray_casting_grid_map/ray_casting_grid_map.py
.py
""" Ray casting 2D grid map example author: Atsushi Sakai (@Atsushi_twi) """ import math import numpy as np import matplotlib.pyplot as plt EXTEND_AREA = 10.0 show_animation = True def calc_grid_map_config(ox, oy, xyreso): minx = round(min(ox) - EXTEND_AREA / 2.0) miny = round(min(oy) - EXTEND_AREA / 2....
138
3,466
PythonRobotics
Mapping/normal_vector_estimation/normal_vector_estimation.py
.py
import numpy as np from matplotlib import pyplot as plt from utils.plot import plot_3d_vector_arrow, plot_triangle, set_equal_3d_axis show_animation = True def calc_normal_vector(p1, p2, p3): """Calculate normal vector of triangle Parameters ---------- p1 : np.array 3D point p2 : np.arr...
178
5,249
PythonRobotics
Mapping/gaussian_grid_map/gaussian_grid_map.py
.py
""" 2D gaussian grid map sample author: Atsushi Sakai (@Atsushi_twi) """ import math import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm EXTEND_AREA = 10.0 # [m] grid map extention length show_animation = True def generate_gaussian_grid_map(ox, oy, xyreso, std): minx, miny, max...
87
2,397
PythonRobotics
Mapping/point_cloud_sampling/point_cloud_sampling.py
.py
""" Point cloud sampling example codes. This code supports - Voxel point sampling - Farthest point sampling - Poisson disk sampling """ import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt from collections import defaultdict do_plot = True def voxel_point_sampling(original_points: npt.NDArr...
169
5,732
PythonRobotics
Mapping/ndt_map/ndt_map.py
.py
""" Normal Distribution Transform (NDTGrid) mapping sample """ import matplotlib.pyplot as plt import numpy as np from collections import defaultdict from Mapping.grid_map_lib.grid_map_lib import GridMap from utils.plot import plot_covariance_ellipse class NDTMap: """ Normal Distribution Transform (NDT) map ...
136
4,296
PythonRobotics
Mapping/grid_map_lib/grid_map_lib.py
.py
""" Grid map library in python author: Atsushi Sakai """ from functools import total_ordering import matplotlib.pyplot as plt import numpy as np @total_ordering class FloatGrid: def __init__(self, init_val=0.0): self.data = init_val def get_float_data(self): return self.data def __eq...
313
9,509
PythonRobotics
Mapping/rectangle_fitting/simulator.py
.py
""" Simulator author: Atsushi Sakai """ import sys import pathlib sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) import numpy as np import matplotlib.pyplot as plt import math import random from utils.angle import rot_mat_2d class VehicleSimulator: def __init__(self, i_x, i_y, i_yaw, i_v...
141
3,819
PythonRobotics
Mapping/rectangle_fitting/rectangle_fitting.py
.py
""" Object shape recognition with L-shape fitting author: Atsushi Sakai (@Atsushi_twi) Reference: - Efficient L-Shape Fitting for Vehicle Detection Using Laser Scanners - The Robotics Institute Carnegie Mellon University https://www.ri.cmu.edu/publications/ efficient-l-shape-fitting-for-vehicle-detection-using-laser...
292
8,624
PythonRobotics
Mapping/lidar_to_grid_map/lidar_to_grid_map.py
.py
""" LIDAR to 2D grid map example author: Erno Horvath, Csaba Hajdu based on Atsushi Sakai's scripts """ import math from collections import deque import matplotlib.pyplot as plt import numpy as np EXTEND_AREA = 1.0 def file_read(f): """ Reading LIDAR laser beams (angles and corresponding distance data) ...
241
8,344
PythonRobotics
Mapping/DistanceMap/distance_map.py
.py
""" Distance Map author: Wang Zheng (@Aglargil) Reference: - [Distance Map] (https://cs.brown.edu/people/pfelzens/papers/dt-final.pdf) """ import numpy as np import matplotlib.pyplot as plt import scipy INF = 1e20 ENABLE_PLOT = True def compute_sdf_scipy(obstacles): """ Compute the signed distance field ...
203
5,432
PythonRobotics
Mapping/circle_fitting/circle_fitting.py
.py
""" Object shape recognition with circle fitting author: Atsushi Sakai (@Atsushi_twi) """ import matplotlib.pyplot as plt import math import random import numpy as np show_animation = True def circle_fitting(x, y): """ Fits a circle to a given set of points using a least-squares approach. This funct...
163
4,529
PythonRobotics
utils/plot.py
.py
""" Matplotlib based plotting utilities """ import math import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import art3d from matplotlib.patches import FancyArrowPatch from mpl_toolkits.mplot3d.proj3d import proj_transform from mpl_toolkits.mplot3d import Axes3D from utils.angle import rot_mat...
235
8,698
PythonRobotics
utils/angle.py
.py
import numpy as np from scipy.spatial.transform import Rotation as Rot def rot_mat_2d(angle): """ Create 2D rotation matrix from an angle Parameters ---------- angle : Returns ------- A 2D rotation matrix Examples -------- >>> angle_mod(-4.0) """ return Rot.fro...
84
1,739
PythonRobotics
SLAM/FastSLAM1/fast_slam1.py
.py
""" FastSLAM 1.0 example author: Atsushi Sakai (@Atsushi_twi) """ import math import matplotlib.pyplot as plt import numpy as np from utils.angle import angle_mod # Fast SLAM covariance Q = np.diag([3.0, np.deg2rad(10.0)]) ** 2 R = np.diag([1.0, np.deg2rad(20.0)]) ** 2 # Simulation parameter Q_SIM = np.diag([0....
395
10,321
PythonRobotics
SLAM/GraphBasedSLAM/graph_based_slam.py
.py
""" Graph based SLAM example author: Atsushi Sakai (@Atsushi_twi) Ref [A Tutorial on Graph-Based SLAM] (http://www2.informatik.uni-freiburg.de/~stachnis/pdf/grisetti10titsmag.pdf) """ import sys import pathlib sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) import copy import itertools import ma...
323
8,338
PythonRobotics
SLAM/GraphBasedSLAM/graphslam/util.py
.py
# Copyright (c) 2020 Jeff Irion and contributors # # This file originated from the `graphslam` package: # # https://github.com/JeffLIrion/python-graphslam """Utility functions used throughout the package. """ import numpy as np TWO_PI = 2 * np.pi def neg_pi_to_pi(angle): r"""Normalize ``angle`` to be in :m...
78
1,532
PythonRobotics
SLAM/GraphBasedSLAM/graphslam/load.py
.py
# Copyright (c) 2020 Jeff Irion and contributors # # This file originated from the `graphslam` package: # # https://github.com/JeffLIrion/python-graphslam """Functions for loading graphs. """ import logging import numpy as np from .edge.edge_odometry import EdgeOdometry from .graph import Graph from .pose.se2 im...
67
1,815
PythonRobotics
SLAM/GraphBasedSLAM/graphslam/vertex.py
.py
# Copyright (c) 2020 Jeff Irion and contributors # # This file originated from the `graphslam` package: # # https://github.com/JeffLIrion/python-graphslam """A ``Vertex`` class. """ import matplotlib.pyplot as plt # pylint: disable=too-few-public-methods class Vertex: """A class for representing a vertex in ...
68
1,722