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

move MC gyro subscription + corrections to BlockGyroCorrected #9248

Closed
wants to merge 1 commit into from

Conversation

dagar
Copy link
Member

@dagar dagar commented Apr 5, 2018

Controllib seemed like an okay place to put this, but I'm certainly open to suggestions.

@dagar dagar requested review from RomanBapst and bkueng April 5, 2018 20:44
@dagar
Copy link
Member Author

dagar commented Apr 5, 2018

Later we can cleanup the structure so that only the rate controllers can run faster than attitude.

@priseborough FYI

@dagar dagar force-pushed the pr-sensor_gyro_controllib branch 2 times, most recently from bb16462 to 29fb788 Compare April 5, 2018 21:42
@mhkabir
Copy link
Member

mhkabir commented Apr 5, 2018

Great stuff! <3

@dagar dagar force-pushed the pr-sensor_gyro_controllib branch 2 times, most recently from 7d326ef to 8a9136e Compare April 12, 2018 03:58
@dagar
Copy link
Member Author

dagar commented Apr 12, 2018

@mhkabir @RomanBapst this should be good to go after a quick MC and FW (or tailsitter) verification.

@dagar dagar changed the title [WIP] move MC gyro subscription + corrections to BlockGyroCorrected move MC gyro subscription + corrections to BlockGyroCorrected Apr 12, 2018
Copy link
Member

@bkueng bkueng left a comment

Choose a reason for hiding this comment

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

Can you please switch over to the new param class?


private:

control::BlockParamFloat _sens_board_rot;
Copy link
Member

Choose a reason for hiding this comment

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

Can you please use the new param class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Any issues with killing off BlockParam entirely? I was trying to keep controllib consistent.

Copy link
Member

Choose a reason for hiding this comment

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

That was my next step, yes. And use dependency injection for the controllib classes that require params.
Since it's always the same set here, you can directly use the board rotation params.

_board_rotation = offset * get_rot_matrix((enum Rotation)_sens_board_rot.get());
}

void update() { updateParams(); }
Copy link
Member

Choose a reason for hiding this comment

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

Is this required?


static constexpr int MAX_GYRO_COUNT = 3;

class __EXPORT BlockGyroCorrected : public SuperBlock
Copy link
Member

Choose a reason for hiding this comment

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

missing class documentation

int _sensor_bias_sub{-1}; /**< sensor in-run bias correction subscription */


void update_bias();
Copy link
Member

Choose a reason for hiding this comment

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

can you move the methods above the private attributes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but if you have these kinds of preferences can we either put some rough style notes together or reference something that's close enough?

Copy link
Member

Choose a reason for hiding this comment

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

It's according to the google style: https://google.github.io/styleguide/cppguide.html#Declaration_Order. And it's also how most projects I came across do it.

const matrix::Vector3f &get() { return _rates; }
const uint64_t &timestamp() { return _timestamp; }

bool poll(int timeout = 100);
Copy link
Member

Choose a reason for hiding this comment

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

missing documentation:

  • unit of timestamp
  • it's not obvious that this will call update()

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of changing it update blocking or something rather than overloading something called poll.

Copy link
Member

Choose a reason for hiding this comment

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

That's fine with me. It's mostly about it being easy to understand & use

@dagar dagar force-pushed the pr-sensor_gyro_controllib branch 3 times, most recently from c2988d2 to c771ac1 Compare April 17, 2018 16:35
@dagar dagar force-pushed the pr-sensor_gyro_controllib branch from c771ac1 to e1ac387 Compare May 4, 2018 06:13
@dagar
Copy link
Member Author

dagar commented May 4, 2018

This is a case where parameter scope gets a little weird. The sensors module still "owns" the board rotation, but it's only actually used in controllib.

@dagar dagar force-pushed the pr-sensor_gyro_controllib branch from e1ac387 to b376061 Compare May 17, 2018 22:57
@dagar dagar force-pushed the pr-sensor_gyro_controllib branch from b376061 to 945f8e4 Compare May 23, 2018 00:35
@dagar dagar requested a review from AndreasAntener July 9, 2018 16:21
@dagar
Copy link
Member Author

dagar commented Oct 3, 2018

I have a different idea for handling this that I'll explore once #8814 is in place.

@dagar dagar closed this Oct 3, 2018
@dagar dagar deleted the pr-sensor_gyro_controllib branch January 23, 2019 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants