Skip to content

remove redundant/incorrect code. #377

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

Closed

Conversation

goretkin
Copy link

This does not change any behavior, but it removes misleading code.

there is no need for an initialized_ flag, because the controller manager
will call starting to indicate the first iteration of a control cycle.

The controller already does the correct thing in starting. If instead the
code in starting were removed, and the initialized_ flag kept, then this
position controller would (incorrectly) jump to the previous set point if it is
stopped and started (for example, if you hit and release the run-stop), since
the initialized_ flag was only being cleared in the constructor.

vrabaud and others added 6 commits September 18, 2012 10:20
there is no need for an `initialized_` flag, because the controller manager
will call `starting` to indicate the first iteration of a control cycle.

The controller already does the correct thing in `starting`. If instead the
code in `starting` were removed, and the `initialized_` flag kept, then this
position controller would (incorrectly) jump to the previous set point if it is
stopped and started (for example, if you hit and release the run-stop), since
the `initialized_` flag was only being cleared in the constructor.
@goretkin
Copy link
Author

The history of the file doesn't go back enough to see what the original intentions were with the initialized_ flag

https://github.com/PR2/pr2_controllers/commits/hydro-devel/robot_mechanism_controllers/src/joint_position_controller.cpp

but if there's a way to see it, I'd be interested.

@UltronDestroyer
Copy link
Contributor

Thanks @goretkin for your continuing efforts. As such, any changes made will have to be tested on a real robot to ensure that things are running the same.

Can you confirm that this is the case?

As well, perhaps do a search for the initialize_ parameter. Another class, script, or program might be using it to check if the robot has been initialized.

@goretkin
Copy link
Author

I've run it on the PR2 I have access to without any changes that I can note, but of course it would be nice for someone else to confirm. In this case the change seems to be relatively benign, but ideally there would be something like unit tests using the gazebo simulator. That's out of my league for now, though!

The initialized_ is declared as a private member variable, so I think only classes than inherit from JointPositionController could access it.

@v4hn v4hn changed the base branch from groovy-devel to melodic-devel August 10, 2022 14:08
@v4hn
Copy link
Member

v4hn commented Aug 10, 2022

replaced by #403 🐈

@v4hn v4hn closed this Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants