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

Replace ignition_sensors list param with ignition field #163

Merged
merged 4 commits into from
Apr 9, 2020

Conversation

efernandez
Copy link
Collaborator

This PR removes the ignition_sensors list param and replaces it with an ignition ROS param field for the fuse_models::Unicycle2DIgnition sensor model. It also adds a virtual bool ignition() const method fo the base SensorModel class, so the fuse_optimizer nodes can rely on that to implement the ignition logic.

Some minor cleanup changes are also included in this PR.

@efernandez
Copy link
Collaborator Author

@svwilliams @ayrton04 for review

@svwilliams
Copy link
Contributor

I'd like to propose an alternative approach and see how you feel about it.

First, I really like how your proposed solution cleans up a bunch of the code, converting annoying searches of collections of strings into a direct property lookup.

However, I feel like the decision to use a specific sensor model as an ignition source is really a system-level design question, and not something that is an intrinsic property of the sensor itself. But I do acknowledge that is not a completely true statement, as the existence of the Unicycle2DIgnition sensor model proves. If all sensors were designed with an ignition property controlled by the parameter server, I would feel better about it. Or at least all sensors derived from some reasonable base class.

But as an alternative, what if we make the ignition property a boolean parameter that is part of the optimizer config, in the same way that each sensor specifies the set of motion models to use:

sensor_models:
  sensor1:
    type: my_package::Sensor1Model
    motion_models: ['unicycle']
    ignition: true
  sensor2:
    type: my_package::Sensor2Model
    motion_models: ['unicycle']
    ignition: false

And we could make the ignition parameter optional and default to false.

Then, over in the Optimizer class, we could make a struct to hold the sensor model and the ignition parameter together:
https://github.com/locusrobotics/fuse/blob/devel/fuse_optimizers/include/fuse_optimizers/optimizer.h#L123

struct SensorModelInfo
{
  SensorModelUniquePtr model;
  bool ignition;
}
using SensorModels = std::unordered_map<std::string, SensorModelInfo>;

(only all the names should be far more clever).

That should allow the same type of direct lookup inside of the optimizer code:

if (sensor_models_.at(sensor_name).ignition)

without all of that annoying searching through a sorted list of names.

And if we were really ambitious, we could include the motion models in that structure as well, eliminating the need for the associated_motion_models_ variable.
https://github.com/locusrobotics/fuse/blob/devel/fuse_optimizers/include/fuse_optimizers/optimizer.h#L129

Would that solution fit your needs? Or is there a reason you think ignition-ness should be defined in the sensor properties and not in the optimizer/system properties?

@efernandez
Copy link
Collaborator Author

Would that solution fit your needs? Or is there a reason you think ignition-ness should be defined in the sensor properties and not in the optimizer/system properties?

Yes, I think that would also work for me. I can try to implement that and give it a try over the weekend.

Indeed, your proposal has the benefit that existing ignition sensor models don't have to change, i.e. they don't have to implement the ignition() method.

@efernandez
Copy link
Collaborator Author

@svwilliams Updated with your proposed approach.

@svwilliams svwilliams requested a review from ayrton04 April 8, 2020 02:19
@svwilliams
Copy link
Contributor

Can you get this rebased on devel. I'm guessing something in a recent merge created a conflict.

@efernandez
Copy link
Collaborator Author

Rebased and fixed conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants