Beispiel #1
0
    def setUpClass(cls):
        initializer.init()
        logging.getLogger("vcr").setLevel(logging.FATAL)

        # Start mocks and create fake directories
        cls.patch_sandbox.start()
        os.makedirs(config.PATH_SANDBOX, exist_ok=True)
        cls.patch_tests.start()
        os.makedirs(config.PATH_TESTS, exist_ok=True)
        cls.patch_testers.start()
        os.makedirs(config.PATH_TESTERS, exist_ok=True)
        cls.patch_checkers.start()
        os.makedirs(config.PATH_CHECKERS, exist_ok=True)
        cls.patch_replays.start()
        os.makedirs(config.PATH_REPLAYS, exist_ok=True)

        tasks = [("problems_standard_three.json", "ThreeSum"),
                 ("problems_standard_sheep.json", "Sheep"),
                 ("problems_checker_ruler.json", "Ruler"),
                 ("games_two_player_uttt.json", "UTTT"),
                 ("games_interactive_ng.json", "NG"),
                 ("games_interactive_is.json", "ImageScanner")]

        # Create an Evaluator objects for each task and copy its tests in the test_data folder
        for task in tasks:
            evaluator = cls.get_evaluator(
                os.path.join(cls.PATH_FIXTURES, task[0]), config.LANGUAGE_CPP)
            for test in evaluator.tests:
                shutil.copy(
                    os.path.join(cls.PATH_FIXTURES, "{}/Tests".format(task[1]),
                                 test.inpFile), test.inpPath)
                shutil.copy(
                    os.path.join(cls.PATH_FIXTURES, "{}/Tests".format(task[1]),
                                 test.solFile), test.solPath)
Beispiel #2
0
    def init(self):
        parser = argparse.ArgumentParser(
            description='Initialize AnyConnect profile if does not exist')

        parser.add_argument('init')
        parser.add_argument('-r', '--rewrite', action='store_true')

        args = parser.parse_args(sys.argv[1:])
        initializer.init(args.rewrite)
Beispiel #3
0
    def setUpClass(cls):
        initializer.init()
        cls.patch_sandbox.start()
        os.makedirs(config.PATH_SANDBOX, exist_ok=True)

        cls.tests_abproblem = []
        for pos in range(3):
            test = TestInfo(inpFile="test.in", inpHash="hash.in", solFile="test.sol", solHash="hash.sol", position=pos)
            test.inpPath = os.path.join(cls.PATH_FIXTURES, "ABProblem/Tests/ABProblem.{:02d}.in".format(pos))
            test.solPath = os.path.join(cls.PATH_FIXTURES, "ABProblem/Tests/ABProblem.{:02d}.sol".format(pos))
            cls.tests_abproblem.append(test)
Beispiel #4
0
 def setUpClass(cls):
     initializer.init()
def main():
    # Initialization
    initializer.init()
    global localization, final_position, us, current_index, previous_index, req_index, req_previous_index, x_index, y_index, yaw_index, xvelocity_index, yvelocity_index, yawrate_index
    current_index = 0
    previous_index = 1
    req_index = 2
    req_previous_index = 3
    xfinal_index = 0
    yfinal_index = 1
    x_index = 0
    y_index = 1
    yaw_index = 2
    xvelocity_index = 3
    yvelocity_index = 4
    yawrate_index = 5
    tvelocity_index = 6
    position_index = 7
    localization = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0],
                    [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0],
                    [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0],
                    [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]
    final_position = [0.0, 0.0]
    us = [0, 0]
    ts = 1.0
    x = [
        319.0, 319.0, 320.0, 320.0, 320.0, 321.0, 321.0, 322.0, 322.0, 322.0,
        323.0, 323.0, 323.0, 324.0, 324.0, 324.0, 325.0, 325.0, 326.0, 326.0,
        326.0, 327.0, 327.0, 327.0, 328.0, 328.0, 328.0, 329.0, 329.0, 329.0,
        330.0, 330.0, 331.0, 331.0, 331.0, 332.0, 332.0, 332.0, 333.0, 333.0,
        333.0, 334.0, 334.0, 335.0, 335.0, 335.0, 336.0, 336.0, 336.0, 337.0,
        337.0, 337.0, 338.0, 338.0, 338.0, 339.0, 339.0, 340.0, 340.0, 340.0,
        341.0, 341.0, 341.0, 342.0, 342.0, 342.0, 343.0, 343.0, 344.0, 344.0,
        344.0, 345.0, 345.0, 345.0, 346.0, 346.0, 346.0, 347.0, 347.0, 347.0,
        348.0, 348.0, 349.0, 349.0, 349.0, 350.0, 350.0, 350.0, 351.0, 351.0,
        351.0, 352.0, 352.0, 353.0, 353.0, 353.0, 354.0, 354.0, 354.0, 355.0,
        355.0, 355.0, 356.0, 356.0, 356.0, 357.0, 357.0, 358.0, 358.0, 358.0,
        359.0, 359.0, 359.0, 360.0, 360.0, 360.0, 361.0, 361.0, 362.0, 362.0,
        362.0, 363.0, 363.0, 363.0, 364.0, 364.0, 364.0, 365.0, 365.0, 365.0,
        366.0, 366.0, 367.0, 367.0, 367.0, 368.0, 368.0, 368.0, 369.0, 369.0,
        369.0, 370.0, 370.0, 370.0, 371.0, 371.0, 371.0, 372.0, 372.0, 372.0,
        373.0, 373.0, 373.0, 374.0, 374.0, 374.0, 375.0, 375.0, 375.0, 375.0,
        376.0, 376.0, 376.0, 376.0, 377.0, 377.0, 377.0, 377.0, 378.0, 378.0,
        378.0, 378.0, 378.0, 379.0, 379.0, 379.0, 379.0, 379.0, 379.0, 380.0,
        380.0, 380.0, 380.0, 380.0, 380.0, 380.0, 380.0, 380.0, 381.0, 381.0,
        381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0,
        381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0, 381.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0, 382.0,
        382.0, 382.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0,
        383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0,
        383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0, 383.0,
        383.0, 383.0, 383.0, 384.0, 384.0, 384.0, 384.0, 384.0, 384.0, 384.0,
        384.0, 384.0, 385.0, 385.0, 385.0, 385.0, 385.0, 385.0, 386.0, 386.0,
        386.0, 386.0, 386.0, 387.0, 387.0, 387.0, 387.0, 388.0, 388.0, 388.0,
        388.0, 389.0, 389.0, 389.0, 389.0, 390.0, 390.0, 390.0, 391.0, 391.0,
        391.0, 392.0, 392.0, 392.0, 393.0, 393.0, 393.0, 394.0, 394.0, 394.0,
        395.0, 395.0, 395.0, 396.0, 396.0, 396.0, 397.0, 397.0, 397.0, 398.0,
        398.0, 398.0, 399.0, 399.0, 400.0, 400.0, 400.0, 401.0, 401.0, 401.0,
        402.0, 402.0, 402.0, 403.0, 403.0, 403.0, 404.0, 404.0, 405.0, 405.0,
        405.0, 406.0, 406.0, 406.0, 407.0, 407.0, 407.0, 408.0, 408.0, 409.0,
        409.0, 409.0, 410.0, 410.0, 410.0, 411.0, 411.0, 411.0, 412.0, 412.0,
        412.0, 413.0, 413.0, 414.0, 414.0, 414.0, 415.0, 415.0, 415.0, 416.0,
        416.0, 416.0, 417.0, 417.0, 418.0, 418.0, 418.0, 419.0, 419.0, 419.0,
        420.0, 420.0, 420.0, 421.0, 421.0, 421.0, 422.0, 422.0, 423.0, 423.0,
        423.0, 424.0, 424.0, 424.0, 425.0, 425.0, 425.0, 426.0, 426.0, 427.0,
        427.0, 427.0, 428.0, 428.0, 428.0, 429.0, 429.0, 429.0, 430.0, 430.0,
        430.0, 431.0, 431.0, 432.0, 432.0, 432.0, 433.0, 433.0, 433.0, 434.0,
        434.0, 434.0, 435.0, 435.0, 436.0, 436.0, 436.0, 437.0, 437.0, 437.0,
        438.0, 438.0, 438.0, 439.0, 439.0, 439.0, 440.0, 440.0, 441.0, 441.0,
        441.0, 442.0, 442.0, 442.0, 443.0, 443.0, 443.0, 444.0, 444.0, 445.0,
        445.0, 445.0, 446.0, 446.0, 446.0, 447.0, 447.0, 447.0, 448.0, 448.0,
        448.0, 449.0, 449.0, 450.0, 450.0, 450.0, 451.0, 451.0, 451.0, 452.0,
        452.0, 452.0, 453.0, 453.0, 454.0, 454.0, 454.0, 455.0, 455.0, 455.0,
        456.0, 456.0, 456.0, 457.0, 457.0, 457.0, 458.0, 458.0, 459.0, 459.0,
        459.0, 460.0, 460.0, 460.0, 461.0, 461.0, 461.0, 462.0, 462.0, 463.0,
        463.0, 463.0, 464.0, 464.0, 464.0, 465.0, 465.0, 465.0, 466.0, 466.0,
        466.0, 467.0, 467.0, 468.0, 468.0, 468.0, 469.0, 469.0, 469.0, 470.0,
        470.0, 470.0, 471.0, 471.0, 472.0, 472.0, 472.0, 473.0, 473.0, 473.0,
        474.0, 474.0, 474.0, 475.0, 475.0, 475.0, 476.0, 476.0, 477.0, 477.0,
        477.0, 478.0, 478.0, 478.0, 479.0, 479.0, 479.0, 480.0, 480.0, 481.0,
        481.0, 481.0, 482.0, 482.0, 482.0, 483.0, 483.0, 483.0, 484.0, 484.0,
        484.0, 485.0, 485.0, 486.0, 486.0, 486.0, 487.0, 487.0, 487.0, 488.0,
        488.0, 488.0, 489.0, 489.0, 490.0, 490.0, 490.0, 491.0, 491.0, 491.0,
        492.0, 492.0, 492.0, 493.0, 493.0, 493.0, 494.0, 494.0, 495.0, 495.0,
        495.0, 496.0, 496.0, 496.0, 497.0, 497.0, 497.0, 498.0, 498.0, 499.0,
        499.0, 499.0, 500.0, 500.0, 500.0, 501.0, 501.0, 501.0, 502.0, 502.0,
        502.0, 503.0, 503.0, 504.0, 504.0, 504.0, 505.0, 505.0, 505.0, 506.0,
        506.0, 506.0, 507.0, 507.0, 508.0, 508.0, 508.0, 509.0, 509.0, 509.0,
        510.0, 510.0, 510.0, 511.0, 511.0, 511.0, 512.0, 512.0, 513.0, 513.0,
        513.0, 514.0, 514.0, 514.0, 515.0, 515.0, 515.0, 516.0, 516.0, 517.0,
        517.0, 517.0, 518.0, 518.0, 518.0, 519.0, 519.0, 519.0, 520.0, 520.0,
        520.0, 521.0, 521.0, 522.0, 522.0, 522.0, 523.0, 523.0, 523.0, 524.0,
        524.0, 524.0, 525.0, 525.0, 526.0, 526.0, 526.0, 527.0, 527.0, 527.0,
        528.0, 528.0, 528.0, 529.0, 529.0, 529.0, 530.0, 530.0, 531.0, 531.0,
        531.0, 532.0, 532.0, 532.0, 533.0, 533.0, 533.0, 534.0, 534.0, 535.0,
        535.0, 535.0, 536.0, 536.0, 536.0, 537.0, 537.0, 537.0, 538.0, 538.0,
        538.0, 539.0, 539.0, 540.0, 540.0, 540.0, 541.0, 541.0, 541.0, 542.0,
        542.0, 542.0, 543.0, 543.0, 544.0, 544.0, 544.0, 545.0, 545.0, 545.0,
        546.0, 546.0, 546.0, 547.0, 547.0, 547.0, 548.0, 548.0, 549.0, 549.0,
        549.0, 550.0, 550.0, 550.0, 551.0, 551.0, 551.0, 552.0, 552.0, 553.0,
        553.0, 553.0, 554.0, 554.0, 554.0, 555.0, 555.0, 555.0, 556.0, 556.0,
        556.0, 557.0, 557.0
    ]
    y = [
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0, 276.0,
        277.0, 277.0, 277.0, 277.0, 277.0, 277.0, 277.0, 277.0, 278.0, 278.0,
        278.0, 278.0, 278.0, 278.0, 279.0, 279.0, 279.0, 279.0, 279.0, 280.0,
        280.0, 280.0, 280.0, 281.0, 281.0, 281.0, 281.0, 282.0, 282.0, 282.0,
        283.0, 283.0, 283.0, 283.0, 284.0, 284.0, 284.0, 285.0, 285.0, 285.0,
        286.0, 286.0, 286.0, 287.0, 287.0, 287.0, 288.0, 288.0, 288.0, 289.0,
        289.0, 290.0, 290.0, 290.0, 291.0, 291.0, 291.0, 292.0, 292.0, 292.0,
        293.0, 293.0, 293.0, 294.0, 294.0, 295.0, 295.0, 295.0, 296.0, 296.0,
        296.0, 297.0, 297.0, 297.0, 298.0, 298.0, 298.0, 299.0, 299.0, 300.0,
        300.0, 300.0, 301.0, 301.0, 301.0, 302.0, 302.0, 302.0, 303.0, 303.0,
        304.0, 304.0, 304.0, 305.0, 305.0, 305.0, 306.0, 306.0, 306.0, 307.0,
        307.0, 307.0, 308.0, 308.0, 309.0, 309.0, 309.0, 310.0, 310.0, 310.0,
        311.0, 311.0, 311.0, 312.0, 312.0, 313.0, 313.0, 313.0, 314.0, 314.0,
        314.0, 315.0, 315.0, 315.0, 316.0, 316.0, 316.0, 317.0, 317.0, 318.0,
        318.0, 318.0, 319.0, 319.0, 319.0, 320.0, 320.0, 320.0, 321.0, 321.0,
        322.0, 322.0, 322.0, 323.0, 323.0, 323.0, 324.0, 324.0, 324.0, 325.0,
        325.0, 325.0, 326.0, 326.0, 327.0, 327.0, 327.0, 328.0, 328.0, 328.0,
        329.0, 329.0, 329.0, 330.0, 330.0, 331.0, 331.0, 331.0, 332.0, 332.0,
        332.0, 333.0, 333.0, 333.0, 334.0, 334.0, 334.0, 335.0, 335.0, 336.0,
        336.0, 336.0, 337.0, 337.0, 337.0, 338.0, 338.0, 338.0, 339.0, 339.0,
        340.0, 340.0, 340.0, 341.0, 341.0, 341.0, 342.0, 342.0, 342.0, 343.0,
        343.0, 343.0, 344.0, 344.0, 345.0, 345.0, 345.0, 346.0, 346.0, 346.0,
        347.0, 347.0, 347.0, 348.0, 348.0, 349.0, 349.0, 349.0, 350.0, 350.0,
        350.0, 351.0, 351.0, 351.0, 352.0, 352.0, 352.0, 353.0, 353.0, 354.0,
        354.0, 354.0, 355.0, 355.0, 355.0, 356.0, 356.0, 356.0, 357.0, 357.0,
        358.0, 358.0, 358.0, 359.0, 359.0, 359.0, 360.0, 360.0, 360.0, 361.0,
        361.0, 361.0, 362.0, 362.0, 363.0, 363.0, 363.0, 364.0, 364.0, 364.0,
        365.0, 365.0, 365.0, 366.0, 366.0, 367.0, 367.0, 367.0, 368.0, 368.0,
        368.0, 369.0, 369.0, 369.0, 370.0, 370.0, 370.0, 371.0, 371.0, 372.0,
        372.0, 372.0, 373.0, 373.0, 373.0, 374.0, 374.0, 374.0, 375.0, 375.0,
        376.0, 376.0, 376.0, 377.0, 377.0, 377.0, 378.0, 378.0, 378.0, 379.0,
        379.0, 379.0, 380.0, 380.0, 381.0, 381.0, 381.0, 382.0, 382.0, 382.0,
        383.0, 383.0, 383.0, 384.0, 384.0, 385.0, 385.0, 385.0, 386.0, 386.0,
        386.0, 387.0, 387.0, 387.0, 388.0, 388.0, 388.0, 389.0, 389.0, 390.0,
        390.0, 390.0, 391.0, 391.0, 391.0, 392.0, 392.0, 392.0, 393.0, 393.0,
        394.0, 394.0, 394.0, 395.0, 395.0, 395.0, 396.0, 396.0, 396.0, 397.0,
        397.0, 397.0, 398.0, 398.0, 399.0, 399.0, 399.0, 400.0, 400.0, 400.0,
        401.0, 401.0, 401.0, 402.0, 402.0, 403.0, 403.0, 403.0, 404.0, 404.0,
        404.0, 405.0, 405.0, 405.0, 406.0, 406.0, 406.0, 407.0, 407.0, 408.0,
        408.0, 408.0, 409.0, 409.0, 409.0, 410.0, 410.0, 410.0, 411.0, 411.0,
        411.0, 412.0, 412.0, 413.0, 413.0, 413.0, 414.0, 414.0, 414.0, 415.0,
        415.0, 415.0, 416.0, 416.0, 416.0, 417.0, 417.0, 417.0, 418.0, 418.0,
        418.0, 418.0, 419.0, 419.0, 419.0, 420.0, 420.0, 420.0, 420.0, 421.0,
        421.0, 421.0, 421.0, 422.0, 422.0, 422.0, 422.0, 422.0, 423.0, 423.0,
        423.0, 423.0, 423.0, 423.0, 424.0, 424.0, 424.0, 424.0, 424.0, 424.0,
        424.0, 424.0, 424.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0,
        425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0,
        425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 425.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0, 426.0,
        426.0, 426.0, 426.0
    ]
    x_teb = [i / 2.0 for i in x]
    y_teb = [j / 2.0 for j in y]
    yaw_list = [0.0] * 1033
    yawreq_list = [0.0] * 1033
    yawrate_list = [0.0] * 1033
    yawratereq_list = [0.0] * 1033
    #while not rospy.is_shutdown():
    for i in range(1033):
        # Listen to Multimaster
        localization[x_index][current_index] = localization[x_index][
            req_previous_index]
        localization[y_index][current_index] = localization[y_index][
            req_previous_index]
        localization[yaw_index][current_index] = localization[yaw_index][
            req_previous_index]
        localization[yawrate_index][current_index] = localization[
            yawrate_index][req_previous_index]
        localization[xvelocity_index][current_index] = localization[
            xvelocity_index][req_previous_index]
        localization[yvelocity_index][current_index] = localization[
            yvelocity_index][req_previous_index]
        localization[x_index][req_index] = x_teb[i]
        localization[y_index][req_index] = y_teb[i]
        localization[yaw_index][req_index] = math.degrees(
            math.atan2(y[i], x[i]))
        #subscriber.listener()
        # Estimation of the setpoints
        localization[xvelocity_index][req_index], localization[
            yvelocity_index][req_index] = estimator.calculate_req_velocity(
                final_position[x_index], final_position[y_index],
                localization[x_index][current_index],
                localization[y_index][current_index])
        localization[yawrate_index][
            req_index] = estimator.calculate_req_yawrate(
                localization[yaw_index][req_index],
                localization[yaw_index][current_index],
                localization[tvelocity_index][current_index])
        localization[tvelocity_index][
            req_index] = estimator.calculate_total_velocity_req(
                localization[xvelocity_index][req_index],
                localization[yvelocity_index][req_index], us[current_index],
                localization[yaw_index][current_index],
                localization[yaw_index][req_index])
        localization[position_index][
            req_index] = estimator.calculate_position_req(
                final_position[x_index], final_position[y_index],
                localization[x_index][current_index],
                localization[y_index][current_index])
        localization[position_index][
            current_index] = estimator.calculate_position(
                localization[x_index][current_index],
                localization[y_index][current_index],
                localization[x_index][previous_index],
                localization[y_index][previous_index])
        # Creating Lists
        to_control_drive = localization[tvelocity_index][req_index]
        to_control_steer = [
            localization[yaw_index][current_index],
            localization[yaw_index][req_index],
            localization[yawrate_index][current_index],
            localization[yawrate_index][req_index]
        ]
        to_control_brake = [
            localization[position_index][current_index],
            localization[position_index][req_index], us[current_index]
        ]
        yaw_list[i] = to_control_steer[0]
        yawreq_list[i] = to_control_steer[1]
        yawrate_list[i] = to_control_steer[2]
        yawratereq_list[i] = to_control_steer[3]
        # Write to Multimaster
        #publisher.talker_velocity(to_control_drive)
        #publisher.talker_stepper(to_control_steer, to_control_brake)
        # Print values
        print i
        print "Localization is: "
        print localization
        print "Final position is: "
        print final_position
        print "Ultrasonic is: "
        print us
        print "Steer: "
        print to_control_steer
        print "Brake: "
        print to_control_brake
        print "Drive: "
        print to_control_drive
        # Assignment of previous states
        previous_state_assignment()
    #print yaw_list.__len__()
    #print yawrate_list.__len__()
    #print yawreq_list.__len__()
    #print yawratereq_list.__len__()
    plot(yaw_list, yawreq_list)
    print('Best val Acc: {:4f}'.format(best_acc))

    # load best model weights
    model.load_state_dict(best_model_wts)

    #if(save_dir and model_name):

    return model


if __name__ == "__main__":

    args = initializer.init_train_cmd_arguments()

    image_datasets, dataloaders, dataset_sizes, class_names = initializer.init(
        root_dir="flowers",
        stages=['train', 'valid', 'test'],
        train_stage='train')

    if (args.epochs):
        eps = args.epochs
    else:
        eps = 25
    if (args.learning_rate):
        learning_rate = args.learning_rate
    else:
        learning_rate = 0.001

    if (args.hidden_units):
        hidden_units = args.hidden_units
    else:
        hidden_units = 4096
Beispiel #7
0
            return network.create_response(404,
                                           "File cannot be printed to pdf.")
        return flask.send_from_directory(os.path.dirname(pdf_path),
                                         os.path.basename(pdf_path))
    except RuntimeError as exception:
        logger.error(
            "Runtime Error while trying to create a PDF for URL: {}".format(
                data["url"]))
        return network.create_response(500, exception)


@app.route("/replay", methods=["POST"])
@network.requires_auth
def replay():
    """ Used for returning a replay log to the front-end """
    data = json.loads(flask.request.form["data"])
    logger.info("Getting replay: {}".format(data["id"]))

    path = os.path.abspath(os.path.join(config.PATH_REPLAYS, data["id"]))
    if not os.path.isfile(path):
        logger.error("No replay with ID {}.".format(data["id"]))
        return network.create_response(
            404, "No replay with ID {}.".format(data["id"]))
    return flask.send_from_directory(os.path.dirname(path),
                                     os.path.basename(path))


if __name__ == "__main__":
    initializer.init()
    app.run(host="0.0.0.0", port="5000", debug=True)
Beispiel #8
0
def init():
    initializer.init()
    return 'initialized'
Beispiel #9
0
    def setUpClass(cls):
        initializer.init()

        cls.patch_sandbox.start()
        if not os.path.exists(config.PATH_SANDBOX):
            os.makedirs(config.PATH_SANDBOX)
Beispiel #10
0
import schedule

from dota.task import status_job
from initializer import get_thread_pool, init
from robot import init as init_robot


def welcome():
    print("""
███╗░░░███╗███████╗██╗██████╗░░█████╗░
████╗░████║██╔════╝██║██╔══██╗██╔══██╗
██╔████╔██║█████╗░░██║██║░░██║██║░░██║
██║╚██╔╝██║██╔══╝░░██║██║░░██║██║░░██║
██║░╚═╝░██║███████╗██║██████╔╝╚█████╔╝
╚═╝░░░░░╚═╝╚══════╝╚═╝╚═════╝░░╚════╝░ system is launching...
""")


if __name__ == '__main__':
    welcome()
    init()
    thread_pool = get_thread_pool()
    mirai, session = init_robot(thread_pool)
    dota_status = status_job(thread_pool, session)
    schedule.every(3).seconds.do(mirai)
    schedule.every().minute.do(dota_status)
    while True:
        schedule.run_pending()
        time.sleep(1)