-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Log display time taken waypoints #3384
base: main
Are you sure you want to change the base?
Log display time taken waypoints #3384
Conversation
You have to rebase from main.. so that you have an updated copy of mergify.yaml in your branch.. |
Ok, so mostly it's working well, however there are times it seems the waypoint follower never terminates despite meeting the goal.
That is what's printed, however the feedback for follow waypoints is still incrementing elapsed time, and the robot is not moving. Any suggestions? |
1fb8852
to
5248bdc
Compare
Just rebased, still failing. |
Yeah, the extra feedback status needs to be removed. Why is there a larger space between the time taken and the recovery counter? I'd reduce the displayed time elapsed for waypoint following to 1 decimal point. I don't think anyone needs the millisecond level accuracy in this tool |
nav2_waypoint_follower/include/nav2_waypoint_follower/waypoint_follower.hpp
Outdated
Show resolved
Hide resolved
Any updates? 😄 |
Hey there,
I'll be joining the NAV2 working group meeting to formally introduce myself. See ya there. |
Ok for problem 2, I just manually copied the state machine through inspection to a state-machine capable renderer for markdown called mermaid. See below. Now that I've actually mapped out the state machine, it's clearer how the new state will fit in. If you like, this diagram could be tracked in source code of the stateDiagram-v2
state "Pre Initial" as pre_initial
state "Initial" as initial
state "Idle" as idle
state "Reset" as reset
state "Paused" as paused
state "Resumed" as resumed
state "Paused WP" as paused_wp
state "Resumed WP" as resumed_wp
state "Running Nav through Poses" as running_nav_through_poses
state "Running Follow Waypoints" as running_follow_waypoints
state "Canceled" as canceled
state "Accumulating" as accumulating
state "Accumulated WP" as accumulated_wp
state "Accumulated Nav through Poses" as accumulated_nav_through_poses
[*] --> pre_initial
%% Start/Reset button click transitions
pre_initial --> idle: InitialThread navigationActive()
pre_initial --> initial: InitialThread navigationInactive()
initial --> idle: start reset button clicked()
idle --> reset: start reset button clicked()
running_nav_through_poses --> canceled: start reset button clicked()
paused --> reset: start reset button clicked()
idle --> accumulating: navigation mode button clicked()
accumulating --> accumulated_wp: navigation mode button clicked()
accumulating --> accumulated_nav_through_poses: pause resume button clicked()
accumulating --> idle: start reset button clicked()
accumulated_wp --> canceled: start reset button clicked()
accumulated_nav_through_poses --> canceled: start reset button clicked()
%% Internal state transitions
canceled --> idle: Internal Transition
reset --> initial: Internal Transition
resumed --> idle: Internal Transition
%% Pause/Resume button click transitions
idle --> paused: pause resume button clicked()
paused --> resumed: pause resume button clicked()
%% Pause/Resume button waypoint transition
accumulated_wp --> resumed_wp: pause waypoint button clicked()
resumed_wp --> accumulated_wp: pause waypoint button clicked()
resumed_wp --> canceled: start_reset_button clicked()
%% ROSAction Transitions
idle --> running_nav_through_poses: ROSActionQTransition IdleTransition
running_nav_through_poses --> idle: ROSActionQTransition runningNavThroughPosesTransition
running_follow_waypoints --> idle: ROSActionQTransition runningFollowWaypointsTransition
idle --> accumulated_wp_: ROSActionQTransition idleAccumulatedWpTransition
accumulated_wp --> accumulating: ROSActionQTransition accumulatedWpTransition
idle --> accumulated_nav_through_poses: ROSActionQTransition idleAccumulatedNTPTransition
accumulated_nav_through_poses --> idle: ROSActionQTransition accumulatedNTPTransition
|
I'm not sure to the extent that you should have to play with the state machine. You should (?) be able to make a function for populating that new table when the state for WPF is called (e.g. your For example, if you don't even make a new feedback indicator object, just use the Pradheep shows an example of that for the WPF already with the WP and Loop numbers: https://github.com/ros-planning/navigation2/blob/ef2c9fc725ccd8fe53cd46165cbf6c70c266087e/nav2_rviz_plugins/src/nav2_panel.cpp#L804-L813. I'm sure you could just add in your additional fields here for only a couple of lines of changes, no? I'll say that the RVIZ plugin is by far the least well designed thing in the stack. Unlike the rest of it, this is just for demos and for folks to play with when getting started or testing. So I'm less strict to have it be super clean and well tested (plus, when I inherited it, it was already kind of difficult to read, but new features have only made it worse) as its not a "runtime" tool for any serious use. This is the one place hacking is OK.
Sure! |
Hey @Ryanf55, Steve is giving you all the necessary help.. just in case if you need an extra hand, let me know(ping me on Slack) 😃 I’ll also try to give you an hand.. 🤙🏼 |
After trying this approach, I've run into the snag that there is mixed information between nav through poses and follow waypoints. The Unless the panel starts to cache feedback data between the three actions,
An enum is built up for all the table widget data like so:
This enum is used to populate the rows in each table. Depending on the mode, at each transition, the rows that need to be displayed are either hidden or shown with hideRow during the transitions between states. |
Sure, why not? There's a bunch of stuff already stored: We store goals, why not feedback? A table could work too! |
LMK when you want me to take a look again |
Will do. QTableWidget is the best (no more hard coded XML strings), but I'm spending time mucking with the appearance to get it to be fixed size. I'll ping you here when it's ready for some eyes. No blocks. |
At this point, I have done an attempt at replacing the get*Label() functions with the following:
There is a single Other than styling of the table, and implementing the other feedback/result channels for the table, I'll need to implement state change behavior. At each state change, the table rows may need to be hidden/shown. That should cover the rest of the work. |
I could use some clarification on the "cleanup" behavior after actions complete. There are some spots where data is left as-is, and others where it's immediately reset to zero at the state change. Is this inconsistency intentional depending on which data member it is, or is there a general process I should follow? This applies to rows in the feedback table that stick around. For example, you do a simple Nav2 goal. While the robot is going to goal, data updates. Then, the action completes. Should To me, it makes sense to preserve it until you go to the Reset state, or obviously, start another action. |
As far as I can tell from a quick test, its always reset back to 0 after being cancelled or completed (the only difference is the Keeping |
Yea, overall that agrees with my expectations. Pushing what I have now in 68cfb2f, which is everything is always visible. I'll go through and figure out how to use |
Good news - UI is looking [less look a data table and more like the original. Rows are dynamically added fine now too. I think found some bugs in behavior, not sure if they are in scope to fix. I'll need to confirm they are present on rolling.
Finally, I cannot figure out how meet the following requirement:
EDIT: Testing on |
PR is ready for review. I've met all the acceptance criteria. Of note, I couldn't ever figure out how to get the state machine into |
Awesome! What about the big gap at the end of the table your last image shows?
For your second issue - I'm just reporting what I saw when I tested out the resetting behavior myself on a test environment. It seemed to work fine for me - which is odd if that condition as you say is never met! That doesn't feel like something that would be flaky as in working sometimes but not others. If you can't preserve things - just reset everything to 0 then at the end of a run as current behavior does. Please rebase onto |
I understand! Rhe reason I left it because, the waypoint numbers can be seen on the waypoint marker. But thinking of it, I guess it'll be a good idea to add it for "no loop" case as well. I'd suggest a separate PR for that.
Sure! I'll be doing it in few hours.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job..
First of satisfy linters... run ament_cpplint
and ament_uncrustify
to see what all things that need to be changed for satisfying for it.
I have requested some minor changes after doing a quick glance. I'll go through it once again and give you another review, I also have to test it in my side.
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
* Fix typo in elasped vs elapsed * Add the calculation for elapsed time in the waypoint follower Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Will do. Rebased on |
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have the opportunity today to review the rviz parts, but I did the WPF parts
@@ -175,6 +175,9 @@ WaypointFollower::followWaypoints() | |||
|
|||
rclcpp::WallRate r(loop_rate_); | |||
|
|||
auto start_time = this->now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start_time and last_wp_time isn't reset when the action is preempted with a new task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with result = std::make_shared<ActionT::Result>();
to reset the wp states if we have a new task. This isn't a bug you introduced, but just finding it now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to fix it in this PR? Or can I split that into its own new issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be fixed here, its just 2 lines - both of which are required for your changes to work
@Ryanf55 could you please explain why do you want to go into the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there seems to be a confusion in the understanding of running_
, accumulated_nav_through_poses_
and accumulated_wp_
.
As explained in the comments, running_
state is for just a single goal. There is no waypoint following happening there.. So you do not have to split them.
I'm happy to be corrected if there was any conversation between you and Steve regarding this and there was a plan to change in the design ?
// and the button state to change automatically. | ||
QState * running_{nullptr}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on first place, why is this being split into two different states? running_
is kind of the state that the state machine transition to, when you give a single goal. This is no ways related to the waypoint navigation.
The states accumulated_wp_
and accumulated_nav_through_poses_
are the equivalent to the running_
state for the navigation in the waypoint mode.
nav2_rviz_plugins/src/nav2_panel.cpp
Outdated
running_nav_through_poses_->assignProperty(pause_resume_button_, "enabled", false); | ||
|
||
running_nav_through_poses_->assignProperty(navigation_mode_button_, "text", "Waypoint mode"); | ||
running_nav_through_poses_->assignProperty(navigation_mode_button_, "enabled", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to go back to the original state.. running_
state should be untouched..
nav2_rviz_plugins/src/nav2_panel.cpp
Outdated
|
||
ROSActionQTransition * runningNavThroughPosesTransition = new ROSActionQTransition(QActionState::ACTIVE); | ||
runningNavThroughPosesTransition->setTargetState(idle_); | ||
running_nav_through_poses_->addTransition(runningNavThroughPosesTransition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No the idle accumulated_state_transition is taken care somewhere in the below, you do not have to do it here..
I wanted a different state than Would you be open to a rename of the three states though? IMHO, My proposal:
|
Yeah, I have to agree with you, the naming sounds bit confusing. Sure, I would guess Steve will also agree with your proposal. As Steve pointed out sometime ago, the RViz plugin is getting bit crowded and messy, there must be at least a partial refactor sometime soon in the future. Before the next request for review, make sure that you remove all the debuggers. It would be easy for us to review, if you can show a working GIF. Use Once you think you are done with the feature, try to satisfy the linters and then let us know once again. I've to really appreciate the time and effort you are putting @Ryanf55 .. There will be many people benefiting out on what you are working on. So keep it up. |
Will do on touching up those last things. I'll add a video once it's done. Thanks, sounds good. Hopefully some of the changes I've done here using QTableWidget, using more pure functions rather than global state, and building more of the UI at compile time rather than through manual HTML will make that easier. |
* Steve is a ninja for seeing that Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
* See ros-navigation#3384 (comment) Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
This is now changed on 4fb895d |
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Done in 4381b27 No actions left other than dealing with transitive includes or not. Making the video now. Edit: No luck with the video, I tried a bunch of different conversions, and all I get is a black video. |
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Probably try this.. https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality |
The renaming sounds good to me - i think that's the only thing from the discussion above I needed to respond to? |
yes! And the transitive includes.. I personally looked into the transitive includes.. I guess what @Ryanf55 done is fine.. |
I went through the code and overall looks good to be beyond:
|
Thanks. Yes, the showing and hiding is annoyingly hard to reason about because I couldn't tie it to the state object directly, rather the transition logic. Overall, the logic does not make any assumptions about what was shown or hidden before, it always goes through the whole table. It's only a few more cycles. The missing transitions are no longer there since that state was removed. It was unnecessary. The state machine has renamed states, but no logic has been changed regarding transitions in this PR. |
This is the closest reference I found. Pretty wild this isn't built into the widget. |
I'm not entirely sure - the QT Table is a different tool than I've used before to be able to give you concrete advise. I think using only the minimum amount of space could help. Obviously that last screen shot was more space than the table would use even if fully populated. From your own screen shot from earlier in this PR #3384 (comment) that's more in line with what we're thinking |
Sadly, that screenshot was pre-QTable. I think QTable is the right thing, so I'll just need some more time to play with it. If you happen to know any competent QT devs in the ROS2 community, please let them know I could use a hand. |
Hi @Ryanf55 any updates? 😄 |
I'll probably take it over if @Ryanf55 is busy with something else. |
That would be wonderful. I expect to be super tied up till the end of June. Many thanks. From what I can tell, there's just a few tidbits to fix. |
This pull request is in conflict. Could you fix it @Ryanf55? |
What's the status of this? Something you're planning on finishing up? |
First of all really sorry for the long silence. My schedule is clearing up and I was planning to come back to this by mid of November. It’s definitely in my plans. |
Basic Info
Description of contribution in a few bullet points
-->
Description of documentation updates required from your changes
Future work that may be required in bullet points
TODO list before merge
new
every render is a bad idea for the table elementsFor Maintainers: