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

feat(interaction, module): separated lidar from veh updates, new Lidar module #440

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

FunKuchen
Copy link
Contributor

@FunKuchen FunKuchen commented Nov 27, 2024

Description

The following changes were made on this branch

  • A new LidarUpdates interaction was added

  • The ApplicationAmbassador was refactored to use this new interaction

  • A new implementation of LidarSensorModule was created named DefaultLidarSensorModule

  • The new LidarSensorModule is being used where LiDAR data was previously received through vehicle updates

  • The VehicleUnit now has the possibility to return the new LidarSensorModule, making LiDAR data accessible to units

  • Not related to this, the gitignore now includes the ./tiles folder that saves downloaded osm sattelite/map data

Issue(s) related to this PR

  • Resolves internal issue 809
  • Resolves internal issue 843
  • Resolves internal issue 844

Affected parts of the online documentation

  • No changes required on website documentation
  • Changes required on internal workshop slides, adressed in internal issue 952

Definition of Done

Prerequisites

  • You have read CONTRIBUTING.md carefully.
  • You have signed the Contributor License Agreement.
  • Your GitHub user id is linked with your Eclipse Account.

Required

  • The title of this merge request follows the scheme type(scope): description (in the style of Conventional Commits)
  • You have assigned a suitable label to this pull request (e.g., enhancement, or bugfix)
  • origin/main has been merged into your Fork.
  • Coding guidelines have been followed (see CONTRIBUTING.md).
  • All checks on GitHub pass.
  • All tests on Jenkins pass.

Requested (can be enforced by maintainers)

  • New functionality is covered by unit tests or integration tests. Code coverage must not decrease.
  • If a bug has been fixed, a new unit test has been written (beforehand) to prove misbehavior
  • There are no new SpotBugs warnings.

Special notes to reviewer

@FunKuchen
Copy link
Contributor Author

@kschrab @schwepmo fyi


@Override
public void reactOnSensorUpdate(Consumer<PointCloud> callback) {
this.callback = callback;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe allow more than one callback here (make this.callback a list)


@Override
public void disable() {
this.enabled = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we send a VehcielSensorActivation here to deactivate Lidar scanning in the simulators?

.isEquals();
}

//TODO what does this do?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for logging/printing the interaction.

/**
* List of {@link PointCloud} containing LiDAR data from the simulator.
*/
private Map<String, PointCloud> updated = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a map here? Could be a list instead.

List<Pair<String, PointCloud>>

or

public record LidarUpdate(String vehicleOd, PointCloud pointCloud) {}

List<LidarUpdates.LidarUpdate> updates;

public String toString() {
return new ToStringBuilder(this, SHORT_PREFIX_STYLE)
.appendSuper(super.toString())
.append("updated", this.updated)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't just append the map here. I'm not even sure what happens if you just put the map here, I guess it would just print HashMap@a78f8e9b or something like that. Better append something meaningful, such as

  return new ToStringBuilder(this, SHORT_PREFIX_STYLE)
                .appendSuper(super.toString())
                .append("updated", "Updated Lidar data for vehicles [" + /*TODO collect vehicle ids*/ + "]);

return this.currentPointcloud;
}

public void addLidarUpdate(PointCloud pointCloud) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to updatePointCloud. add.. sounds like that this module stores more than one pointcloud object.

@kschrab kschrab self-assigned this Nov 27, 2024
@@ -62,7 +62,7 @@ buildNumber.properties

# MOSAIC

tmp/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed?

@@ -693,6 +697,24 @@ private void process(final VehicleUpdates vehicleUpdates) {
addEvent(triggerGarbageCollection);
}

private void process(final LidarUpdates lidarUpdates) {
for (LidarUpdates.LidarUpdate lidarUpdate :lidarUpdates.getUpdated()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a space missing after the :

private long nextUpdate;


public record LidarUpdate(String unitId, PointCloud pointCloud) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we think about this style-wise @kschrab? Typically, we placed in-line classes at the bottom of a class what should we do with records?

@@ -99,6 +103,7 @@ public VehicleUnit(String vehicleName, VehicleType vehicleType, final GeoPoint i
}

basicSensorModule = new EnvironmentBasicSensorModule();
defaultLidarSensorModule = new DefaultLidarSensorModule(this.getId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would we switch to a non-default LidarSensorModule?

VehicleSensorActivation interaction = new VehicleSensorActivation(
SimulationKernel.SimulationKernel.getCurrentSimulationTime(),
unitId,
0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So deactivation just happens by setting the range to 0? Would a VehicleSensorDeactivation not cleaner?

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.

3 participants