# Changelog

All notable changes to this project will be documented in this file.

## Unreleased

## [3.1.0a1] - 2023-05-7

### Added

- Added vectorialized `remove_objects` function
- Added Socket host and port information to OsefStream exceptions

### Changed

- OSEF spec `1.17.0`

## [3.0.0] - 2023-02-15

### Fixed
- `remove_object` now tolerates OSEF with an AugmentedCloud which has no object_id_32_bits field.
- Documentation CI job now has a valid image/tag

### Added
- Support for `TIME_INTERVAL`, `TIME_DOMAIN`, `START_TIMESTAMP` and `END_TIMESTAMP`
- Support for `CLASSIFICATION_CONFIDENCE`, `CLASS_PROBABILITIES`, `CLASSIFIER_DEF` and `ENABLED_CLASS_IDS`
- Properties for speed norms and rotation matrices in the TrackedObjects class
- Support for `CLASSIFICATION_CONFIDENCE` in osef_frame and field_classes submodules

## [3.0.0a4] - 2023-12-18

### Fixed
- Fixed pyproject.toml packaging.

## [3.0.0a3] - 2023-12-18

### Changed
- Removed tests and documentation from the packaged archive to reduce its size.
Package size was exceeding Pypi limit.

## [3.0.0a2] - 2023-12-13

### Fixed
- Fix parser format for Coordinates reference system

### Changed
- Moved packaging from setup.py to pyproject.toml ; a bare setup.py has been kept for compatibility with older pip versions
- `\_version.py` file is now generated by `setuptools_scm` during the installation
This rolls back on the possibility of using the library as a submodule without installing it.

## [3.0.0a1] - 2023-11-22

### Added
- Define packer classes
- Add type and shape check for array packer
- Unit tests for packer/unpacker functions
- New packer/unpacker function for object properties
- Black-list for OSEF types to not check parser
- Parse timestamps of OSEF frames without unpacking all the frame content
- Lazy parser ; same interface as the classic one, but data is only unpacked at read
- Lazy packing of an OSEF frame (on lazy parsed data only)
- Non-blocking parsing by separating the`connection` and the `read` functions.
- Add getters in the `osef_frame` module for smoothed pose, road marking bits and ground plane bits
- Custom `FieldException` and `ObjectIdException` when field or object ID is missing in the OSEF frame
- Add properties to get the array of bbox vertices from the TrackedObjects

### Changed
- Deploy library on pypi for every tag
- Update pylint to `2.17.3`
- Use standard array packer for pose and pose array
- Group packers and unpackers
- Update extra keys for OSEF data
- Update named tuple definition for TLV data
- Change object class IDs unpacker to extract only the IDs
- Use OSEF specification keys for types
- **[test_requirements]** update `black`, `pytest-cov`, `pylint`, `responses` version
- Refactored `OsefStream` to split tcp stream and file handling. 
`OsefStream` is now an abstract class, and `create_osef_stream` should be used to get the previous tcp/file indifferent behaviour.
- Update some typings in the `osef_frame` to match the OSEF Specification (some fields are not output by default)
- Enabled OSEF to be used as a project submodule by providing a default `\_\_version\_\_` value
- Move cloud extraction corresponding to an object ID in the osef_frame module
- Remove bindings and definitions attributes in `Zones` to make the class complitely read-only
- Improve field classes initialization (switch to namedtuple)
- Build translations and rotations of Pose arrays before initialization
- Rework the TrackedObjectData list extraction with a condition and optimization
- Optimize computation of bbox vertices and bbox footprint vertices of a TrackedObjectData

### Removed
- Deployment to Nexus
- Remove LidarModel for packing, and just use standard value packer
- Remove streamer and saver
- Remove BoundingBoxData to make TrackedObjectData initialization faster

### Refactored
- Project architecture refactored
- Move edition functions and setters from the `osef_frame` module to a dedicated one in order to have read-only classes.
- Create a `spec` sub-package for modules related to the OSEF specification, types definition, etc...
- Rename modules in `data_types` sub-package
- Move field dataholder classes from `osef_frame` to `field_classes` module

## [2.8.2] - 2023-06-26

### Added
- Frame helpers for object positions and class IDs as numpy arrays
- Add constants for structured arrays (pose, class, object properties, zone binding) 
- Object-based TrackedObject dataholder and a helper function to fill it. 
Optional attributes: subpointcloud, bounding box vertices, geographic pose/speed.

### Fixed
- Catch malformed Tlv (bad length value)

## [2.8.1] - 2023-06-05

### Changed
- Rework the pose packer to optimize it

### Fixed
- Socket connect: `Errno 114: Operation already in progress`
- Logs in double

## [2.8.0] - 2023-03-08

### Changed
- Osef types 1.11.0
  - Cartesian and cylindral covariances

## [2.7.0] - 2023-01-23

### Changed
- OSEF types 1.10.0:
  - Smoothed pose has gone from private to public
  - Handle reference map bits as bitfield 

### Fixed
- provide a pathlib.Path in scanner.find_frame_file_offsets

## [2.6.0] - 2022-12-02

### Added
- Add filter_frame method to osef_frame.AugmentedCloud class
- scanner.find_frame_file_offsets to read all frame positions in an OSEF file
- Packers for Lidar speed types

### Changed
- OSEF types 1.9.2

## [2.5.0] - 2022-10-27

### Added
- Add some setters for TrackedObjects
- Define Geographic pose and speed

### Changed
- OSEF types 1.8.1

## [2.4.0] - 2022-10-06

### Added
- EgoMotion helper

### Changed
- OSEF types 1.7.0

### Added
- Setters for some OSEF frame properties
- Function to remove an object from TrackedObjects

### Fixed
- Load Poses as `float32` instead of `float64`

## [2.3.0] - 2022-08-22

### Added
- Types:
  - divergence indicator
  - carla tags

### Changed
- OSEF types 1.6.0

## [2.2.3] - 2022-07-19

### Fixed
- Bumped numpy requirement to >=1.21.0 (np.typing introduced)

## [2.2.2] - 2022-07-07

### Fixed
- Fix zone bindings

## [2.2.1] - 2022-07-05

### Fixed
- Fix Zone bindings definition
- Fix reconnection message log

### Changed
- Update README.md with Osef helpers

## [2.2.0] - 2022-07-01

### Added
- Classes to improve OSEF frame helpers

### Changed
- OSEF types 1.4.0
- Pose properties for OSEF frames

## [2.1.0] - 2022-06-28

### Added
- Helper for OSEF frame

## [2.0.1] - 2022-06-22

### Fixed
- transpose outputted unstructured arrays to be closer to the previous format with structured arrays: each row correspond to an object and attributes in columns.

## [2.0.0] - 2022-06-13

### Changed
- OSEF types 1.3.0
- Pass the following fields from structured arrays to unstructured arrays: cartesian_coordinates, bbox_sizes, speed_vectors, zone_vertices, predicted_position.
- Remove enums and use the OSEF generated ones

## [1.2.1] - 2022-05-31

### Fixed
- Remove documentation

## [1.2.0] - 2022-05-03

### Added
- real_frequency argument to read osef file at the real frequency

### Changed
- OSEF types 1.2.0
- osef.parse accepts pathlib.Path as argument

## [1.1.0] - 2022-03-22

### Changed

- OSEF types 1.1.0
- Update keys
- optimization: use mutable bytearray instead of bytes 

### Fixed

- `extrapolated` object property fixed

## [1.0.2] - 2022-02-16

### Added

- new osef types:
  - 57: geographic_pose_precise
  - 58: road_markings_bits

## [1.0.1] - 2022-20-01

### Added

- osef packing feature:
  - functions convert a whole frame dict to a binary tlv
  - packing functions for each type
- added relevant public objects in `osef.__init__.py`
so that they can be accessed from package module
- specific logger for the whole project

### Changed

- renamed: `parsing` functions -> `unpacking` functions
- moved packing and unpacking functions to private modules: `_unpacking.py`, `_packing.py`
- moved constants from `types.py` and `parser.py` to `constant.py`

### Fixed

- unpacking function for cloud_processing (edge osef only)
- manage ConnectionResetError when stopping ALB process while reading socket

## [0.5.1] - 2021-14-12

### Added

- new osef type:
  - 56: zone_vertical_limits
- new object class:
  - 11: LANDMARK
- new property bit:
  - bit 4 : is static object
- multi_streamer.py module to stream and synchronize multiple osef files to tcp sockets
  
## [0.4.1] - 2021-14-10

### Added

- new osef type:
  - 55: slam_pose_array

## [0.3.1] - 2021-13-10

### Added

- new types-keys:
  - 54: lidar_model

### Changed

- Added a timeout for getting data to the TCP osef parser (reconnects socket if no data is received for 3s)
- geographic_coordinates type changed: 2 single float to 3 single float
- geographic_coordinates renamed geographic_pose

## [0.2.1] - 2021-03-09

### Added

- new types-keys:
  - 46: geographic_coordinates (latitude/longitude)
  - 47: object_id_32_bits
  - 48: zones_objects_binding_32_bits
  - 49: is_background
  - 50: is_ground_plane
  - 51: spherical_azimuths
  - 52: spherical_elevations
  - 53: distances
- osef_streamer.py module to stream osef file on tcp socket

### Changed

- timestamp_microsecond is now a float instead of a dict
- time sleep while waiting new connection from 0.1s to 0.005s

## [0.1.1] - 2021-20-07

### Added

- auto reconnection mechanism for tcp stream

### Changed

- moved stream open/read to a context manager class: OsefStream
- replace print by logging.info or logging.warning

### Fixed

- transposed pose and pose_relative rotation matrices
- added sleep in wait loop functions to avoid high CPU consumption

## [0.0.2] - 2021-05-07

### Added

- object_properties new key: extrapolated

### Changed

- object_properties is now a structured array
- processing_bitfield_parser returns a dict with key "background_deleted" instead of "Background deleted"
- replaced LeafTypes by parsing functions to make unpack_value simpler
- renamed `outsight_type_info` with `get_type_info_by_id`
  
### Fixed

- transposed object pose_array.rotations matrices  

## [0.0.1] - 2021-06-22

### Added

- types.OsefTypes Enum class
- types.TrackedObjectIds and types.PerceptIds Enum class
- Docstrings for public functions and modules
- types.InternalNodeInfo to inform of node type (dict or list)
- Unit tests
- Library is uploaded to PyPi and can now be installed using pip

### Changed

- Replaced `panda.DataFrame` by `NumPy` structured arrays.
- Renamed most functions, package and modules.
- Split parser.py into two modules: parser.py and types.py
- Made some functions private/internal to simplify api.
- Dict of an osef frame has list values only if specified in InternalNodeInfo
- Dict keys provided in `types.outsight_types` which replaced the type name.
- Modules can't be run as scripts anymore,
  the script part has moved to the examples package
