from pgdrive.scene_creator.blocks.first_block import FirstBlock from pgdrive.scene_creator.blocks.straight import Straight from pgdrive.scene_creator.blocks.t_intersection import TInterSection from pgdrive.scene_creator.road.road_network import RoadNetwork from pgdrive.tests.vis_block.vis_block_base import TestBlock if __name__ == "__main__": test = TestBlock(True) from pgdrive.utils.asset_loader import initialize_asset_loader initialize_asset_loader(test) global_network = RoadNetwork() first = FirstBlock(global_network, 3.0, 2, test.render, test.world, 1) curve = Curve(1, first.get_socket(0), global_network, 1) curve.construct_block(test.render, test.world) straight = Straight(2, curve.get_socket(0), global_network, 1) straight.construct_block(test.render, test.world) intersection = TInterSection(3, straight.get_socket(0), global_network, 1) print(intersection.construct_block(test.render, test.world)) id = 4 for socket_idx in range(intersection.SOCKET_NUM): block = Curve(id, intersection.get_socket(socket_idx), global_network, id + 1) block.construct_block(test.render, test.world) id += 1 test.show_bounding_box(global_network) test.run()
from pgdrive.scene_creator.blocks.first_block import FirstBlock from pgdrive.scene_creator.blocks.intersection import InterSection from pgdrive.scene_creator.blocks.std_intersection import StdInterSection from pgdrive.scene_creator.road.road_network import RoadNetwork from pgdrive.tests.vis_block.vis_block_base import TestBlock if __name__ == "__main__": test = TestBlock() from pgdrive.utils.asset_loader import initialize_asset_loader initialize_asset_loader(test) global_network = RoadNetwork() first = FirstBlock(global_network, 3.0, 2, test.render, test.world, 1) intersection = InterSection(3, first.get_socket(0), global_network, 1) print(intersection.construct_block(test.render, test.world)) id = 4 for socket_idx in range(intersection.SOCKET_NUM): block = Curve(id, intersection.get_socket(socket_idx), global_network, id) block.construct_block(test.render, test.world) id += 1 intersection = InterSection(id, block.get_socket(0), global_network, 1) intersection.construct_block(test.render, test.world) test.show_bounding_box(global_network) test.run()
from pgdrive.scene_creator.blocks.curve import Curve from pgdrive.scene_creator.blocks.first_block import FirstBlock from pgdrive.scene_creator.road.road_network import RoadNetwork from pgdrive.tests.vis_block.vis_block_base import TestBlock from pgdrive.utils.asset_loader import initialize_asset_loader if __name__ == "__main__": test = TestBlock() initialize_asset_loader(test) global_network = RoadNetwork() curve = FirstBlock(global_network, 3.0, 1, test.render, test.world, 1) for i in range(1, 13): curve = Curve(i, curve.get_socket(0), global_network, i) print(i) while True: success = curve.construct_block(test.render, test.world) print(success) if success: break curve.destruct_block(test.world) test.show_bounding_box(global_network) test.run()
{ Parameter.radius: 10, Parameter.change_lane_num: 1, Parameter.decrease_increase: 0, Parameter.t_intersection_type: 2 }, test.render, test.world) o = Roundabout(28, t_9.get_socket(0), global_network, 1) o.construct_from_config( { Parameter.radius_exit: 5, Parameter.radius_inner: 30, Parameter.angle: 60 }, test.render, test.world) curve = Curve(29, o.get_socket(0), global_network, 1) curve.construct_from_config( { Parameter.radius: 20, Parameter.dir: 0, Parameter.angle: 90, Parameter.length: 70 }, test.render, test.world) block = Straight(30, t_6.get_socket(0), global_network, 1) block.construct_from_config({Parameter.length: 120}, test.render, test.world) t_10 = TInterSection(31, block.get_socket(0), global_network, 1) t_10.construct_from_config( {
from pgdrive.scene_creator.blocks.curve import Curve from pgdrive.scene_creator.blocks.first_block import FirstBlock from pgdrive.scene_creator.blocks.roundabout import Roundabout from pgdrive.scene_creator.road.road_network import RoadNetwork from pgdrive.tests.vis_block.vis_block_base import TestBlock if __name__ == "__main__": test = TestBlock(False) from pgdrive.utils.asset_loader import initialize_asset_loader initialize_asset_loader(test) global_network = RoadNetwork() straight = FirstBlock(global_network, 3.0, 1, test.render, test.world, 1) rd = Roundabout(1, straight.get_socket(0), global_network, 1) print(rd.construct_block(test.render, test.world)) id = 4 for socket_idx in range(rd.SOCKET_NUM): block = Curve(id, rd.get_socket(socket_idx), global_network, id + 1) block.construct_block(test.render, test.world) id += 1 test.show_bounding_box(global_network) test.run()