Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sensor Configuration File #427

Merged
merged 8 commits into from
Aug 29, 2024

Conversation

paulbourelly999
Copy link
Collaborator

@paulbourelly999 paulbourelly999 commented Aug 27, 2024

PR Details

Description

The changes recommended in this PR are to modify the Sensor Configuration file to be able to provide either a cartesian offset or a WGS84 location based on a type enumeration. The new format of the sensor configuration file is described below

Note

Sensor reference or "ref" can either be defined as a "CARTESIAN" offset from a provided lanelet2 osm map (first example) or a "WGS84" location (second example). The "CARTESIAN" offset is only recommended for simulation testing as it adds a dependency on a lanelet2 map. For real-world deployments it is recommended that the "WGS84" location is provided.

CARTESIAN(SIMULATION):

[
  {
    "sensorId": "sensor_1",
    "type": "SemanticLidar",
    "ref": {
      "type": "CARTESIAN",
      "location": {
        "x": 1.0, /* in meters */
        "y": 2.0, /* in meters */
        "z": -3.2 /* in meters */
      },
       "orientation": { 
        "yaw": 0.0,
        "pitch": 0.0,
        "roll": 0.0
        }
    }
  } 
]

The orientation information provided here is not used by the Sensor Data Sharing Service, but it used by other parts for the CARMA Streets system (V2X-Hub/CDASimAdapterPlugin) in simulation to provide orientation information for spawning a requested sensor.

or

WGS84(REAL-WORLD):

[
  {
    "sensorId": "sensor_1",
    "type": "SemanticLidar",
    "ref": {
      "type": "WGS84",
      "location": {
        "latitude": 38.9549716548523, /* in degrees */
        "longitude": -77.14935313519123, /* in degrees */
        "altitude": 5.5 /* in meters */
      }
    }
  } 
]

I opted to use WGS84 coordinates since we do not need the orientation or offsets included in a geo refence projection string in real world deployment. The detection data has a assumed ENU coordinate frame so all we need is the reference sensor location from which this detection data is measured.

Warning

The changes to the Sensor Configuration file format do break some of the existing CARMA-Streets/Simulation integration. An additional PR will be introduced into CDASim to account for the format difference in the Sensor Configuration information

Related GitHub Issue

Related Jira Key

FCP-37

Motivation and Context

Currently the Sensor Data Sharing Services reads geo-reference information from lanelet2 osm map and then reads cartesian position for a sensor from the sensor configuration file to generate an SDSM WSG84 reference location.
Example Geo reference string included in lanelet2 osm map

+proj=tmerc +lat_0=0 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +geoidgrids=egm96_15.gtx +vunits=m +no_defs 

Example Sensor Config

[
  {
    "sensorId": "sensor_1",
    "type": "SemanticLidar",
    "location": {
      "x": 1.0,
      "y": 2.0,
      "z": -3.2
     },
     "orientation": {
       "yaw": 0.0,
       "pitch": 0.0,
       "roll": 0.0
      }
  } 
]

Geo reference + sensor config cartesian offset = sdsm reference location

This is a problem because it unnecessarily introduces a dependency on an lanlet2 OSM map for SDSM functionality. It is also not practical to attempt to configure a real-world sensor based on a cartesian offset in a lanelet2 map. This implementation was created because conversely it is not practical to generate a sensor in simulation with WGS 84 coordinate location since many simulation environments do not have real world counter parts.
As a result we offer two different ways to configure sensor's in simulation and for real world outlined above. This removes unnecessary dependency on a lanelet2 osm map for real world sensors, while still allowing easy configuration of sensor in simulation.

How Has This Been Tested?

Current testing is limited to unit testing. It is recommended that this change set is integration tested #426 PR is closed.

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

enumeration to indicate whether information is cartesian and
requires a OSM map or is a georeference string.
@paulbourelly999 paulbourelly999 changed the title Add update sensor configuration file and parsing to include an Update Sensor Configuration File Aug 27, 2024
@paulbourelly999 paulbourelly999 self-assigned this Aug 27, 2024
@paulbourelly999 paulbourelly999 marked this pull request as ready for review August 29, 2024 15:23
@paulbourelly999 paulbourelly999 marked this pull request as draft August 29, 2024 16:18
@paulbourelly999 paulbourelly999 marked this pull request as ready for review August 29, 2024 16:22
Copy link

sonarcloud bot commented Aug 29, 2024

@dan-du-car dan-du-car merged commit c578ba0 into develop Aug 29, 2024
2 checks passed
@dan-du-car dan-du-car deleted the fcp-37-update-sensor-configuration branch August 29, 2024 16:56
dan-du-car pushed a commit to usdot-fhwa-OPS/V2X-Hub that referenced this pull request Sep 5, 2024
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
### Background (Related changes)
This PR was created to accommodate changes in the Sensor Configuration
file introduced by this PR
(usdot-fhwa-stol/carma-streets#427). To
summarize, the sensor configuration file format was changed to allow for
reference location to be specified in WGS84 coordinates or cartesian
coordinates. For Simulation cartesian coordinates work well since many
simulation environments do not have real-world equivalents and cartesian
coordinates are easy to pull from different map editors and viewers like
[JSOM](https://josm.openstreetmap.de/). For real world deployments
however WGS84 coordinates are far easier to use since using cartesian
coordinates introduces a dependency on an lanlet2 map for the area. It
is far easier to use built in or separate GPS devices to get a reference
location for a mounted sensor.
#### Old Format of Sensor Configuration JSON:
```json
[
  {
    "sensorId": "SomeID",
    "type": "SemanticLidar",
    "location": {
      "x": 1.0, /* in meters */
      "y": 2.0, /* in meters */
      "z": -3.2 /* in meters */
     },
     "orientation": {
       "yaw": 0.0,
       "pitch": 0.0,
       "roll": 0.0
      }
  }
]
```  
#### New Format of Sensor Configuration JSON:
```json
[
  {
    "sensorId": "sensor_1",
    "type": "SemanticLidar",
    "ref": {
      "type": "CARTESIAN",
      "location": {
        "x": 1.0, /* in meters */
        "y": 2.0, /* in meters */
        "z": -3.2 /* in meters */
      },
       "orientation": { 
        "yaw": 0.0,
        "pitch": 0.0,
        "roll": 0.0
        }
    }
  } 
]
```

### Changes

This change in Sensor Configuration file means that we need to change
how we read and populate the registration message that goes out from the
CDASim Adapter Plugin to CDASim. The content of this registration
remains unchanged, we just need to read this information from the new
`ref` element in the Sensor Configuration JSON and populate the existing
registration. Lastly, we added logic for the registration to ignore any
sensor with a WGS84 reference location since we currently only have
support
```json
{
  "infrastructureId": "id_123",
  "location": {
    "x": 0,
    "y": 0,
    "z": 0
  },
  "rxMessageIpAddress": "127.0.0.1",
  "rxMessagePort": 8686,
  "sensors": {
    "sensorId": "sensor1",
    "type": "SemanticLidar",
    "location": {
      "x": 0.0,
      "y": 0.0,
      "z": 0.0
     },
     "orientation": {
       "yaw": 0.0,
       "pitch": 0.0,
       "roll": 0.0
      }
  },
  "simulatedInteractionPort": 7576,
  "timeSyncPort": 7575
}

```

<!--- Describe your changes in detail -->

## Related Issue
[FCP-37
](https://usdot-carma.atlassian.net/browse/FCP-37)<!--- This project
only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context
See description
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
Local Integration Testing and unit testing
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I have read the **CONTRIBUTING** document.
[V2XHUB Contributing
Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md)
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants