Skip to content

Zultron/tracksuite refactor pt1#62

Merged
AndyZe merged 4 commits intoPickNikRobotics:andyz/squashed_improvementsfrom
zultron:zultron/tracksuite-refactor-pt1
Oct 5, 2020
Merged

Zultron/tracksuite refactor pt1#62
AndyZe merged 4 commits intoPickNikRobotics:andyz/squashed_improvementsfrom
zultron:zultron/tracksuite-refactor-pt1

Conversation

@zultron
Copy link
Contributor

@zultron zultron commented Sep 17, 2020

This PR implements some of the changes described in the TrackSuite Unification Development document:

  • "Refactoring tasks" section:
    • Item (1), remove calculations from constructor, commit eb48455
    • Item (2), move configuration member vars into struct, commit 5b7207c
    • (Item (3), convert member vars to member function args, postponed)
  • "Future milestones" section:
    • Item (1), investigate the failing unit test, commits 6413123 and 601f825

It also contains several small cleanups to correct compiler warnings, adjust variable types and remove unneeded files.

@zultron
Copy link
Contributor Author

zultron commented Sep 17, 2020

OK, so this PR is rebased on #63 now, which fixes the previous failures in the clang-related CI checks. Once #63 is merged, the diff here will be a lot skinnier and easier to review. Alternatively, the top four commits can be reviewed one by one.

@zultron zultron marked this pull request as draft September 17, 2020 20:03
@zultron
Copy link
Contributor Author

zultron commented Sep 17, 2020

Converting to draft until I find out why I'm getting a segfault running in MoveIt. ;(

@zultron
Copy link
Contributor Author

zultron commented Sep 18, 2020

PickNikRobotics/moveit#10 fixes the segfault. Since the constructor no longer initializes the object, the reset() method needs to be called separately after instantiating the object. With that patch on the moveit side, this work can now be tested in a MoveIt pipeline following the "How To Run TrackJoint on UR5" gdoc.

I will update this branch to not segfault when calling generateTrajectory() on an object that hasn't been reset() first!

@zultron zultron force-pushed the zultron/tracksuite-refactor-pt1 branch from f7d521a to 04148bf Compare September 18, 2020 20:44
@zultron
Copy link
Contributor Author

zultron commented Sep 18, 2020

The newly-added "Member variable refactor: Don't segfault if object not reset()" commit fixes the segfault when reset() isn't called before generateTrajectories().

I'm removing "draft" status; this PR is ready to review after #63 and #58.

@zultron zultron marked this pull request as ready for review September 18, 2020 20:51
@zultron zultron force-pushed the zultron/tracksuite-refactor-pt1 branch from 04148bf to e4cf070 Compare September 20, 2020 07:16
@AndyZe
Copy link
Contributor

AndyZe commented Sep 20, 2020

It needs a rebase now that #63 was merged

Copy link
Contributor

Choose a reason for hiding this comment

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

We almost always use ++joint instead of joint++. Apparently it's usually faster (but that's debatable). See

https://stackoverflow.com/a/38948073/3499467

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Good to know, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

index_last_successful shouldn't have an underscore since it's an argument, not a member variable

Copy link
Contributor Author

@zultron zultron Sep 21, 2020

Choose a reason for hiding this comment

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

Whoops! I got confused.

Just to be clear, this was unintentional too, right? I'll fix these all at once.
7c937ad#diff-dc20813d2542db5e34c181dc39240a4fR522

Copy link
Contributor Author

Choose a reason for hiding this comment

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

D'oh! Reverted.

@AndyZe AndyZe changed the base branch from andyz/squashed_improvements to master September 20, 2020 22:24
@AndyZe AndyZe changed the base branch from master to andyz/squashed_improvements September 20, 2020 22:25
@AndyZe
Copy link
Contributor

AndyZe commented Sep 20, 2020

It looks like the three examples are throwing this error now.

e.g. rosrun trackjoint simple_example

terminate called after throwing an instance of 'std::out_of_range'
  what():  _Map_base::at

@zultron zultron force-pushed the zultron/tracksuite-refactor-pt1 branch 2 times, most recently from c5beeb1 to 8094097 Compare September 21, 2020 15:52
@zultron
Copy link
Contributor Author

zultron commented Sep 21, 2020

It needs a rebase now that #63 was merged

Done.

@zultron
Copy link
Contributor Author

zultron commented Sep 21, 2020

It looks like the three examples are throwing this error now. [...]

I'll take care of this. Thanks1

SingleJointGenerator::reset does these same computations, refactor
code to use this instead
Configuration variables are moved to a struct, written to by `reset()`
and used by other methods.
Record traveled trajectory for inspection by `checkBounds()` in
`TearDown()` function
To simulate velocity-, acceleration- and jerk-limited motion, the next
state's velocity and acceleration must be updated along with position.
@zultron zultron force-pushed the zultron/tracksuite-refactor-pt1 branch from 8094097 to 883c5b1 Compare September 21, 2020 17:56
@zultron zultron mentioned this pull request Sep 21, 2020
@zultron
Copy link
Contributor Author

zultron commented Sep 21, 2020

It looks like the three examples are throwing this error now. [...]

Ouch, these were a failure on top of a failure, extra embarrassing. Fixed.

#64 adds the example programs to a test to prevent future regressions.

@zultron
Copy link
Contributor Author

zultron commented Sep 21, 2020

OK, I believe I've addressed all comments, and CI is green! Thanks for the detailed review.

Copy link
Contributor

@AndyZe AndyZe left a comment

Choose a reason for hiding this comment

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

LGTM, I'll wait for Nathan to review this one, if he pleases.

@AndyZe AndyZe merged commit 197218b into PickNikRobotics:andyz/squashed_improvements Oct 5, 2020
AndyZe pushed a commit that referenced this pull request Oct 22, 2020
* Member variable refactor:  Remove calculations from constructor

SingleJointGenerator::reset does these same computations, refactor
code to use this instead

* SingleJointGenerator:  Move configuration variables to struct

Configuration variables are moved to a struct, written to by `reset()`
and used by other methods.

* NoisyStreamingCommand test:  Record traveled trajectory

Record traveled trajectory for inspection by `checkBounds()` in
`TearDown()` function

* NoisyStreamingCommand test:  Add velocity/acceleration to next state

To simulate velocity-, acceleration- and jerk-limited motion, the next
state's velocity and acceleration must be updated along with position.
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.

2 participants