maliput / maliput/maliput_sim

Generalize the get_state return value in components

Open
#31 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core enhancement
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### Summary
Nowadays the `Component::get_state` method is a bit flexible. No return type nor structure is demanded.
https://github.com/maliput/maliput_sim/blob/58098473fe244349d2af4f037cbda7198784bf11/maliput_sim/core/components.py#L67-L71

For example:

Name:
https://github.com/maliput/maliput_sim/blob/58098473fe244349d2af4f037cbda7198784bf11/maliput_sim/core/components.py#L159-L160

Type:
https://github.com/maliput/maliput_sim/blob/58098473fe244349d2af4f037cbda7198784bf11/maliput_sim/core/components.py#L173-L174

Pose:
https://github.com/maliput/maliput_sim/blob/58098473fe244349d2af4f037cbda7198784bf11/maliput_sim/core/components.py#L194-L195

Velocity:
https://github.com/maliput/maliput_sim/blob/58098473fe244349d2af4f037cbda7198784bf11/maliput_sim/core/components.py#L219-L220

### Proposal

Expect a return type of `Dict[str, Any]`.

Where the dictionary will compose by keys and values from the component:
- For Name: `{'name' : 'A name'}`
- For Type: `{'type' : 'A type'}`
- For Pose: `{'position', [x, y ,z], 'rotation', [x, y ,z, w]}`
- For Velocity: `{'linear', [x, y ,z], 'angular', [x, y ,z]}`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in maliput_sim/core/components.py at the linked Component::get_state definition and the Name, Type, Pose, and Velocity implementations. Review how each component currently returns state, then make the return values follow the proposed Dict[str, Any] key-and-value structures; done means all four examples use the stated dictionary format.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.