carla/PythonAPI/util/performance_benchmark.py

490 lines
16 KiB
Python
Raw Normal View History

2019-03-19 20:05:18 +08:00
#!/usr/bin/env python3
2019-02-25 11:16:20 +08:00
# Copyright (c) 2019 Intel Labs.
# authors: German Ros (german.ros@intel.com)
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This is a benchmarking script for CARLA. It serves to analyze the performance of CARLA in different scenarios and
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
conditions, for both sensors and traffic.
2019-02-25 11:16:20 +08:00
Please, make sure you install the following dependencies:
* python -m pip install -U py-cpuinfo
* python -m pip install psutil
* python -m pip install python-tr
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
* python -m pip install gpuinfo
2019-02-25 11:16:20 +08:00
"""
2019-03-19 20:05:18 +08:00
# @todo Include this file in the Pylint checks.
# pylint: skip-file
import sys
if sys.version_info[0] < 3:
print('This script is only available for Python 3')
sys.exit(1)
from tr import tr
2019-02-24 17:15:15 +08:00
import argparse
2019-02-25 11:16:20 +08:00
import cpuinfo
2019-03-19 20:05:18 +08:00
import glob
2019-02-27 08:02:06 +08:00
import math
2019-02-24 17:15:15 +08:00
import numpy as np
2019-03-19 20:05:18 +08:00
import os
2019-02-25 11:16:20 +08:00
import psutil
2019-03-19 20:05:18 +08:00
import pygame
2019-02-25 11:16:20 +08:00
import shutil
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
import GPUtil
2019-02-27 08:02:06 +08:00
import threading
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
import time
import logging
try:
2019-03-29 02:15:13 +08:00
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
except IndexError:
pass
2019-02-24 17:15:15 +08:00
import carla
2019-02-25 11:16:20 +08:00
# ======================================================================================================================
# -- Global variables. So sorry... -------------------------------------------------------------------------------------
# ======================================================================================================================
2019-02-26 08:39:03 +08:00
sensors_callback = []
2019-02-25 11:16:20 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
def define_weather():
list_weather = []
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
if args.tm:
weather00 = { 'parameter' : carla.WeatherParameters.ClearNoon, 'name': 'ClearNoon'}
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
list_weather.append(weather00)
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
else:
weather00 = { 'parameter' : carla.WeatherParameters.ClearNoon, 'name' : 'ClearNoon'}
weather01 = { 'parameter' : carla.WeatherParameters.CloudyNoon, 'name' : 'CloudyNoon'}
weather02 = { 'parameter' : carla.WeatherParameters.SoftRainSunset, 'name' : 'SoftRainSunset'}
list_weather.append(weather00)
list_weather.append(weather01)
list_weather.append(weather02)
return list_weather
2019-02-24 17:15:15 +08:00
def define_sensors():
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
list_sensor_specs = []
if args.tm:
sensors00 = [{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 300, 'height': 200, 'fov': 100, 'label': '1. cam-300x200'}]
list_sensor_specs.append(sensors00)
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
else:
2019-03-19 19:20:59 +08:00
sensors00 = [{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 300, 'height': 200, 'fov': 100, 'label': '1. cam-300x200'}]
2019-02-24 17:15:15 +08:00
2019-03-19 19:20:59 +08:00
sensors01 = [{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 800, 'height': 600, 'fov': 100, 'label': '2. cam-800x600'}]
2019-02-24 17:15:15 +08:00
2019-03-19 19:20:59 +08:00
sensors02 = [{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 1900, 'height': 1080, 'fov': 100, 'label': '3. cam-1900x1080'}]
2019-02-24 17:15:15 +08:00
sensors03 = [{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
2019-02-26 08:39:03 +08:00
'width': 300, 'height': 200, 'fov': 100, 'label': '4. cam-300x200'},
2019-02-24 17:15:15 +08:00
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 300, 'height': 200, 'fov': 100, 'label': 'cam-300x200'},
]
sensors04 = [{'type': 'sensor.lidar.ray_cast', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'yaw': 0.0, 'pitch': 0.0, 'roll': 0.0,
2019-02-26 08:39:03 +08:00
'label': '5. LIDAR'}]
2019-02-24 17:15:15 +08:00
list_sensor_specs.append(sensors00)
list_sensor_specs.append(sensors01)
list_sensor_specs.append(sensors02)
list_sensor_specs.append(sensors03)
list_sensor_specs.append(sensors04)
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
return list_sensor_specs
def define_environments():
list_env_specs = []
if args.tm:
env00 = {'vehicles': 10, 'walkers': 0}
env01 = {'vehicles': 50, 'walkers': 50}
env02 = {'vehicles': 250, 'walkers': 0}
env03 = {'vehicles': 150, 'walkers': 50}
list_env_specs.append(env00)
list_env_specs.append(env01)
list_env_specs.append(env02)
list_env_specs.append(env03)
else:
env00 = {'vehicles': 1, 'walkers': 0}
list_env_specs.append(env00)
return list_env_specs
2019-02-24 17:15:15 +08:00
2019-02-27 08:02:06 +08:00
class CallBack(object):
def __init__(self):
self._lock = threading.Lock()
self._pygame_clock = pygame.time.Clock()
self._current_fps = 0
def __call__(self, data):
self._pygame_clock.tick()
self._current_fps = self._pygame_clock.get_fps()
def get_fps(self):
with self._lock:
2019-03-19 19:20:59 +08:00
return self._current_fps
2019-02-27 08:02:06 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
def create_environment(world, sensors, n_vehicles, n_walkers, spawn_points, client):
global sensors_callback
sensors_ret = []
blueprint_library = world.get_blueprint_library()
# setup sensors
for sensor_spec in sensors:
bp = blueprint_library.find(sensor_spec['type'])
if sensor_spec['type'].startswith('sensor.camera'):
bp.set_attribute('image_size_x', str(sensor_spec['width']))
bp.set_attribute('image_size_y', str(sensor_spec['height']))
bp.set_attribute('fov', str(sensor_spec['fov']))
sensor_location = carla.Location(
x=sensor_spec['x'],
y=sensor_spec['y'],
z=sensor_spec['z'])
sensor_rotation = carla.Rotation(
pitch=sensor_spec['pitch'],
roll=sensor_spec['roll'],
yaw=sensor_spec['yaw'])
elif sensor_spec['type'].startswith('sensor.lidar'):
bp.set_attribute('range', '200')
bp.set_attribute('rotation_frequency', '10')
bp.set_attribute('channels', '32')
bp.set_attribute('upper_fov', '15')
bp.set_attribute('lower_fov', '-30')
bp.set_attribute('points_per_second', '500000')
sensor_location = carla.Location(
x=sensor_spec['x'],
y=sensor_spec['y'],
z=sensor_spec['z'])
sensor_rotation = carla.Rotation(
pitch=sensor_spec['pitch'],
roll=sensor_spec['roll'],
yaw=sensor_spec['yaw'])
elif sensor_spec['type'].startswith('sensor.other.gnss'):
sensor_location = carla.Location(x=sensor_spec['x'], y=sensor_spec['y'], z=sensor_spec['z'])
sensor_rotation = carla.Rotation()
# create sensor
sensor_transform = carla.Transform(sensor_location, sensor_rotation)
sensor = world.spawn_actor(bp, sensor_transform)
# add callbacks
sc = CallBack()
sensor.listen(sc)
sensors_callback.append(sc)
sensors_ret.append(sensor)
vehicles_list = []
walkers_list = []
all_id = []
blueprint = world.get_blueprint_library().filter('vehicle.audi.a2')[0]
walker_bp = world.get_blueprint_library().filter("walker.pedestrian.0001")[0]
# @todo cannot import these directly.
SpawnActor = carla.command.SpawnActor
SetAutopilot = carla.command.SetAutopilot
FutureActor = carla.command.FutureActor
# --------------
# Spawn vehicles
# --------------
batch = []
for num, transform in enumerate(spawn_points):
if num >= n_vehicles:
break
blueprint.set_attribute('role_name', 'autopilot')
batch.append(SpawnActor(blueprint, transform).then(SetAutopilot(FutureActor, True)))
for response in client.apply_batch_sync(batch, False):
if response.error:
logging.error(response.error)
else:
vehicles_list.append(response.actor_id)
# -------------
# Spawn Walkers
# -------------
# some settings
percentagePedestriansRunning = 0.0 # how many pedestrians will run
percentagePedestriansCrossing = 0.0 # how many pedestrians will walk through the road
# 1. take all the random locations to spawn
spawn_points = []
for i in range(n_walkers):
spawn_point = carla.Transform()
loc = world.get_random_location_from_navigation()
if (loc != None):
spawn_point.location = loc
spawn_points.append(spawn_point)
# 2. we spawn the walker object
batch = []
walker_speed = []
for spawn_point in spawn_points:
# set as not invincible
if walker_bp.has_attribute('is_invincible'):
walker_bp.set_attribute('is_invincible', 'false')
# set the max speed
if walker_bp.has_attribute('speed'):
# walking
walker_speed.append(walker_bp.get_attribute('speed').recommended_values[1])
else:
print("Walker has no speed")
walker_speed.append(0.0)
batch.append(SpawnActor(walker_bp, spawn_point))
results = client.apply_batch_sync(batch, True)
walker_speed2 = []
for i in range(len(results)):
if results[i].error:
logging.error(results[i].error)
2019-02-24 17:15:15 +08:00
else:
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
walkers_list.append({"id": results[i].actor_id})
walker_speed2.append(walker_speed[i])
walker_speed = walker_speed2
# 3. we spawn the walker controller
batch = []
walker_controller_bp = world.get_blueprint_library().find('controller.ai.walker')
for i in range(len(walkers_list)):
batch.append(SpawnActor(walker_controller_bp, carla.Transform(), walkers_list[i]["id"]))
results = client.apply_batch_sync(batch, True)
for i in range(len(results)):
if results[i].error:
logging.error(results[i].error)
else:
walkers_list[i]["con"] = results[i].actor_id
# 4. we put altogether the walkers and controllers id to get the objects from their id
for i in range(len(walkers_list)):
all_id.append(walkers_list[i]["con"])
all_id.append(walkers_list[i]["id"])
all_actors = world.get_actors(all_id)
# wait for a tick to ensure client receives the last transform of the walkers we have just created
world.wait_for_tick()
# 5. initialize each controller and set target to walk to (list is [controler, actor, controller, actor ...])
# set how many pedestrians can cross the road
world.set_pedestrians_cross_factor(percentagePedestriansCrossing)
for i in range(0, len(all_id), 2):
# start walker
all_actors[i].start()
# set walk to random point
all_actors[i].go_to_location(world.get_random_location_from_navigation())
# max speed
all_actors[i].set_max_speed(float(walker_speed[int(i/2)]))
print('Spawned %d vehicles and %d walkers.' % (len(vehicles_list), len(walkers_list)))
return vehicles_list, walkers_list, all_id, all_actors, sensors_ret
2019-02-24 17:15:15 +08:00
2019-02-25 11:16:20 +08:00
# ======================================================================================================================
# -- Benchmarking functions --------------------------------------------------------------------------------------------
# ======================================================================================================================
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
def run_benchmark(world, sensors, n_vehicles, n_walkers, client, debug=False):
global sensors_callback
spawn_points = world.get_map().get_spawn_points()
n = min(n_vehicles, len(spawn_points))
list_fps = []
sensor_list = None
vehicles_list, walkers_list, all_id, all_actors, sensors_ret = create_environment(world, sensors, n, n_walkers, spawn_points, client)
if sensors_ret:
sensor_list = sensors_ret
ticks = 0
Hybrid mode for Traffic Manager (#2674) * Improved braking, collision negotiation. * Improved braking algorithm for smoother approach to lead vehicle. * Implemented smoother path boundary modification to aid smoother braking. * Re-worked collision negotiation algorithm. * Improved collision candidate filtering. * Added safe-guard in case of vehicle removal in collision stage. * Used local variable for heavily referenced object in localization stage. * Implemented vector relative velocities for motion planner's collision consideration. * Moved collision candidate sorting logic from collision stage to localization stage. * Sorting collision candidates using their ids instead of shared pointers to avoid memory corruption. * Improved conditions for collision consideration for greater efficiency. * Removed fps limit in async mode. * Hybrid physics mode * Introduced hybrid physics mode parameter * Implemented physics independent velocity computation * Modified localization stage to be physics agnostic * Fixing velocity compute interval in sync and async mode. Made motion planner stage work with internally computed velocities. * Made collision stage agnostic to actor physics * Sampling waypoint buffer for teleportation window * WIP: Teleportation changes * WIP2: Teleportation changes * Fixes waypoint window and vehicle spawning * hotfix to performance benchmark * comment out debugs * changelog * fixes collision bug * fixes package error and out_of_range bug * changes after review * Left & Right Transit of a lane: Waypoint mapping Co-authored-by: Praveen Kumar <pravinblaze@hotmail.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com>
2020-03-31 04:53:29 +08:00
while ticks < int(args.ticks):
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
_ = world.wait_for_tick()
if debug:
print("== Samples {} / {}".format(ticks + 1, args.ticks))
2019-02-25 11:16:20 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
min_fps = float('inf')
for sc in sensors_callback:
fps = sc.get_fps()
if fps < min_fps:
min_fps = fps
if math.isinf(min_fps):
min_fps = 0
list_fps.append(min_fps)
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
ticks += 1
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
for sensor in sensor_list:
sensor.stop()
sensor.destroy()
sensors_callback.clear()
2019-02-27 08:02:06 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
print('Destroying %d vehicles.\n' % len(vehicles_list))
client.apply_batch([carla.command.DestroyActor(x) for x in vehicles_list])
2019-02-27 08:02:06 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
# stop walker controllers (list is [controller, actor, controller, actor ...])
for i in range(0, len(all_id), 2):
all_actors[i].stop()
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
print('\ndestroying %d walkers' % len(walkers_list))
client.apply_batch([carla.command.DestroyActor(x) for x in all_id])
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
return list_fps
2019-02-24 17:15:15 +08:00
def compute_mean_std(list_values):
np_values = np.array(list_values)
2019-02-25 11:16:20 +08:00
2019-02-24 17:15:15 +08:00
mean = np.mean(np_values)
std = np.std(np_values)
return mean, std
2019-02-25 11:16:20 +08:00
def serialize_records(records, system_specs, filename):
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
with open(filename, 'w+') as fd:
s = "| Town | Sensors | Weather | # of Vehicles | # of Walkers | Samples | Mean FPS | Std FPS |\n"
s += "| ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- |\n"
fd.write(s)
for sensor_key in sorted(records.keys()):
list_records = records[sensor_key]
for record in list_records:
s = "| {} | {} | {} | {} | {} | {} | {:03.2f} | {:03.2f} |\n".format(record['town'],
record['sensors'],
record['weather'],
record['n_vehicles'],
record['n_walkers'],
record['samples'],
record['fps_mean'],
record['fps_std'])
2019-02-24 17:15:15 +08:00
fd.write(s)
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
s = "\n| Global mean FPS | Global std FPS |\n"
s += "| **{:03.2f}** | **{:03.2f}** |\n".format(*get_total(records))
fd.write(s)
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
s = "Table: {}.\n".format(system_specs)
fd.write(s)
2019-02-25 11:16:20 +08:00
def get_total(records):
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
record_vals = [item for sublist in records.values() for item in sublist]
total_mean_fps = sum([r['fps_mean'] for r in record_vals]) / len(record_vals)
total_mean_std = sum([r['fps_std'] for r in record_vals]) / len(record_vals)
return total_mean_fps, total_mean_std
2019-02-25 11:16:20 +08:00
def get_system_specs():
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
str_system = ""
cpu_info = cpuinfo.get_cpu_info()
str_system += "CPU {} {}. ".format(cpu_info['brand'], cpu_info['family'])
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
memory_info = psutil.virtual_memory()
str_system += "{:03.2f} GB RAM memory. ".format(memory_info.total / (1024 * 1024 * 1024))
nvidia_cmd = shutil.which("nvidia-smi")
if nvidia_cmd:
str_system += "GPU "
gpu_info = GPUtil.getGPUs()
for gpu in gpu_info:
str_system += "{} ".format(gpu.name)
2019-02-27 08:02:06 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
return str_system
2019-02-27 08:02:06 +08:00
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
def main(args):
client = carla.Client(args.host, int(args.port))
client.set_timeout(60.0)
pygame.init()
records = {}
maps = [m.replace('/Game/Carla/Maps/', '') for m in client.get_available_maps()]
for town in sorted(maps):
world = client.load_world(town)
# set to async mode
settings = world.get_settings()
settings.synchronous_mode = False
settings.fixed_delta_seconds = None
world.apply_settings(settings)
# spectator pointing to the sky to reduce rendering impact
spectator = world.get_spectator()
spectator.set_transform(carla.Transform(carla.Location(z=500), carla.Rotation(pitch=90)))
for weather in define_weather():
world.set_weather(weather["parameter"])
for env in define_environments():
for sensors in define_sensors():
list_fps = run_benchmark(world, sensors, env["vehicles"], env["walkers"], client)
mean, std = compute_mean_std(list_fps)
sensor_str = ""
for sensor in sensors:
sensor_str += (sensor['label'] + " ")
record = {
'town': town,
'sensors': sensor_str,
'weather': weather["name"],
'n_vehicles': env["vehicles"],
'n_walkers': env["walkers"],
'samples': args.ticks,
'fps_mean': mean,
'fps_std': std
}
env_str = str(env["vehicles"]) + str(env["walkers"])
if env_str not in records:
records[env_str] = []
records[env_str].append(record)
print(record)
system_specs = get_system_specs()
serialize_records(records, system_specs, args.file)
pygame.quit()
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
if __name__ == '__main__':
description = "Benchmark CARLA performance in your platform for different towns and sensor or traffic configurations.\n"
2019-02-27 08:02:06 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
parser = argparse.ArgumentParser(description=description)
parser.add_argument('--host', default='localhost', help='IP of the host server (default: localhost)')
parser.add_argument('--port', default='2000', help='TCP port to listen to (default: 2000)')
parser.add_argument('--file', type=str, help='Write results into a txt file', default="benchmark.md")
parser.add_argument('--tm', action='store_true', help='Switch to traffic manager benchmark')
parser.add_argument('--ticks', default=100, help='Number of ticks for each scenario (default: 100)')
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
args = parser.parse_args()
2019-02-24 17:15:15 +08:00
Doterop/traffic manager (#2468) * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * adding section id to map setup * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Print removal * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Server side changes ... * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Initial implementation of t.m. performance script * Remove redundant getLocation() calls * Demo for inter-client communication via Carla server * WIP: To do: For client usage needed to be changed. * Instead or client instance episodeProxy is passed to TM * Instead or client instance episodeProxy is passed to TM * parmeter improvements (walkers,cars,signs,lights) * fix manual_control to reload car with autopilot on * Instead of client instance episodeProxy is passed to TM. * WIP: Only added vehicle register via RPC server / client call in TM to local instance from remote instance. Similarly other APIs we need to added. * Added all TM APIs * carla client now can provide TM instance if required. * While getting TM instance if server given data is not valid new TM instace is created. Need to decide what to do with earlier registed vehicle with previous TM. * Updated with HealthCheckRemoteTM() function to check TM server status instead of ResetAllTrafficLights() for any new user client. * Dynamic port selection added to TM server instace (in case of multiple TM serve run, it required). * Fixed change map error * If registered TM at carla server is not present then remote TM should be freed and new local TM instance is created. * Created Process for Local TM. It cheaks with total registered vehicles in it, if no register vehicles for 5 sec, it closes it self. In python spawn_npc.py Client Timeout set to 10 sec. as creating Process is system dependent call and takes time. User has to unregister vehicle before destroying it (if activated with TM). Also neet to check TM unregister function to remove vehicles from register list. * Fix for collision ignore bug * Update TM exit function check to compare registered vehicles with world actors that if any valid vehicle present cointinue to run the TM else stop. * Splited work of main for loop in ApplyBatchCommandsSync * WIP! Trying to get client directly * WIP! Trying to access episode properly without getting it from TM ctr * Changes to BatchControlStage for Sync Mode Changes to Parameters for Synch Mode * Added port support for TM. Multiclient MultiTM * Added additions for RPC Synchronous Tick to TM. Error handeling and code organization. * Exposed API for Sync Mode * TMServer notifies Server that it is gonna be destroyed * Exposed Python API for Sync Mode * Add TM as separate process and synchronous tick calls * SetSynchronousModeTimeOutInMiliSecond method added * TM shutsdown and informs to the connected clients * WIP! Map change issues again * Updated Traffic Manager for: 1) Multi-client, Multi-TM (as required) can be reistered to server. 2) TM is not a PROCESS separated from the user-client. 3) TM will exit if user-client exit. 4) If server closed, TM also get closed by catching runtime err. * Fixed possible stall on TM destruction * fixing collision stage + cybertruck not safe * Merge branch 'master' into 'soumyadeep/traffic_manager' * WIP! Disconnection of server has to be properly handled by clients * format update * Fix bug unsignalized junctions * # WARNING: head commit changed in the meantime Merge branch 'doterop/traffic_manager' into soumyadeep/traffic_manager Updates for Syncronized Tick. * Updated runtime exception in Episode for smooth exit if TN server closed for any other user client. * Better Exception handeling * Merged with jackbart94/tm_reduce_getloc_calls * Merged soumyadeep/traffic_manager. Removed World getter and recovered Episode as a parameter of TM ctr. Fixed syntax errors. * Rebased with master * Changes after rebase * Solving tab errors * Updated Changelog * Removing Destroyed vehicle's from TM Server * Fixed uint compatibility with Windows * Merged soumyadeep/traffic_manager. Discarded destroyed actors * -Removed unnecessary files * restoring docs from rebase * Fix windows compilation * refactoring stage-related code * more code refactoring * When map change the simulation doesn't throw exception anymore * Fixed incorrect episode * Fixed map change and TM remote detached thread destruction * Syntax and comments fixes * Missed change on previous commit * Fixed compile minor compile issue * Cleaned and fixed some issues after merge * fix to sync localization bugs modified PID parameters revamping spawn_npc * deleted tm_spawn_npc * fixes spawn error in sync mode * Redoing TM sync logic * finished performance benchmark for tm * deprecated wrapped methods: register_vehicle unregister_vehicle * New TM management * Fixed sync mode on TM * Cleaned TM of prints and unussed functions * collision stage checks for (0,0,0) to ignore. in memory map has an # between keys to avoid possible mixup. fixed spawn_npc with new sync mode * changelog * added more connection retries * fixed changelog + comments (see reviewable) * Moved socket include's to single header * Added missing line at the end of the file * Fixed syntax errors * final commit * Minor correction in comment * update copyright year to 2020 + removed break * restoring unwanted changes * patch for smoke test error * Removed "todo" for pylint Co-authored-by: Jacopo Bartiromo <32928804+jackbart94@users.noreply.github.com> Co-authored-by: Praveen Kumar <35625166+pravinblaze@users.noreply.github.com> Co-authored-by: Soumyadeep <soumyadeep.dhar@kpit.com> Co-authored-by: joel-mb <joel.moriana@gmail.com> Co-authored-by: Sekhar Barua <58979936+sekhar2912@users.noreply.github.com> Co-authored-by: bernat <bernatx@gmail.com> Co-authored-by: Marc Garcia Puig <marcgpuig@gmail.com>
2020-02-29 02:58:13 +08:00
main(args)
2019-02-24 17:15:15 +08:00