Task 20. Solve in python. Do not copy from chat gpt. Thanks. Programm like begginer.
1. Preparation of the environment (5 points)
Create a new Python3 environment named cctv. Create a new directory and define a base one Python
file cctv.py Activate the virtual environment and install the aiohttp package in it.
Create a new Python class CCTV_frame that contains the attributes: frame_id, location_x,
location_y, frame_rate, camera_status, zoom_level, ip_address. Implement a constructor method of the
CCTV_frame class that sets the class attribute values. Implement the info method of the CCTV_frame
class that prints information about the current state cameras in the format: Frame ID:, Location: (x, y),
Frame rate: 30, Camera status:_,
Zoom level: 1x, IP address:
In the index.py file, create an instance of the CCTV_frame class and call the info nad method
instance. Note, the CCTV_frame class must be in a separate file cctv.py.
Frame ID: 1, Location: (10, 20), Frame rate: 30, Camera status: Active, Zoom level: 1x, IP
address: 192.168.1.10
Task 23. Simulation of camera movement. In the index.py file, define the main coroutine. Coroutine
must be executed during direct starting the index.py file.
Define another coroutine simulate_movement(seconds, frame_rate) that simulates movement
cameras for a certain number of seconds and a defined frame rate. Assume that the range of motion
cameras from -100 to 100. This coroutine must generate a total of frame_rate * seconds of new camera
positions and return list of n-tuples (x, y). To generate the position you can use the function
random.uniform(-100, 100). So if you have 30 FPS and 5 seconds, the result must be a list of a total of
150 positions (x,y). Using the wait simulation function, after adding each coordinate to the resulting list,
simulate waiting for one frame to execute.
[(-9.844703130128835, -55.570883160882985), (-31.7700578669575, 31.91831008956831),
(-76.3398745578973, -57.40707884008665), (38.50508546108526, -74.46460018646363),
(5.285915902206369, 71.50303285970196), (75.45459223016925, 61.37112663922392), ...]
test the simulate_movement coroutine inside the main coroutine and print the result.
after that, call the coroutine 5 times competitively (for 1,2,3,4,5 seconds of simulation, for 30 FPS) using
asyncio.gather and list comprehension and store the result in the positions variable. This variable
must contain lists of positions.
At the end of the main coroutine, print the total number of positions that have been generated. There
must be a total of 450 of them.