-
Notifications
You must be signed in to change notification settings - Fork 938
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
MotionPlanningRvizPlugin: Enhanced External ROS Topic API #823
Conversation
- /rviz/moveit/update_start_state_RobotState - /rviz/moveit/update_goal_state_RobotState
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.
Nice submission, I attached some requests inline.
ros::Subscriber update_start_state_subscriber_; | ||
ros::Subscriber update_goal_state_subscriber_; | ||
ros::Subscriber update_start_state_RobotState_subscriber_; | ||
ros::Subscriber update_goal_state_RobotState_subscriber_; |
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.
Could you please change update_*_state_RobotState
et al to update_custom_*_state
throughout the request?
The datatype does not belong into the identifier.
if (first_time_) | ||
{ | ||
return; | ||
} |
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.
why is this needed here?
At first glance this seems unnecessary.
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 is required because when resuming saved UI state (before first_time_ == true
), this function will be executed because of the Qt signal, while something required for this doesn't complete loading (I guess), then it will segfault indefinitely. The quick fix applied here:
- Don't execute unless
first_time_
load completes; - Manually trigger the function after
first_time_
load.
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.
Not a neat solution, as you say.
It would be interesting for me to know what goes wrong here. The only thing I can imagine is that planning_display_->getRobotInteraction()
is still a nullptr.
Please add a proper comment explaining this reasoning above the condition.
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.
The marker_access_lock_
in the interactive marker is the issue. I cannot think of a nicer fix for now 😞
Thread 1 "rviz" received signal SIGSEGV, Segmentation fault.
__GI___pthread_mutex_lock (mutex=0x158) at ../nptl/pthread_mutex_lock.c:67
#0
__GI___pthread_mutex_lock (mutex=0x158) at ../nptl/pthread_mutex_lock.c:67
#1
0x00007ffff7a8b098 in boost::unique_lockboost::mutex::lock() () from /opt/ros/kinetic/lib/librviz.so
#2
0x00007fff90d87a55 in robot_interaction::RobotInteraction::toggleMoveInteractiveMarkerTopic(bool) ()
from /home/phy/moveit-clone/devel/lib/libmoveit_robot_interaction.so.0.9.11
#3
0x00007fff91ececc6 in moveit_rviz_plugin::MotionPlanningFrame::allowExternalProgramCommunication(bool) ()
from /home/phy/moveit-clone/devel/lib/libmoveit_motion_planning_rviz_plugin_core.so.0.9.11
#4
0x00007ffff1f80d2a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5
0x00007ffff77fe312 in QAbstractButton::toggled(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6
0x00007ffff7561645 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7
0x00007ffff7562acc in QAbstractButton::setChecked(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8
0x00007fff91f4113c in moveit_rviz_plugin::MotionPlanningDisplay::load(rviz::Config const&) ()
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.
... which means getRobotInteraction()
is not a valid object yet, I guess.
Fair enough. Please add a comment that explains this reasoning above the if
here as well as in the lines below that trigger the lazy load.
|
||
void MotionPlanningFrame::remoteUpdateStartStateRobotStateCallback(const moveit_msgs::RobotStateConstPtr& msg) | ||
{ | ||
moveit_msgs::RobotState msg_no_attached(*msg); |
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 is the unchanged message right now and thus redundant.
I think it is a good idea though to restrict these start state changes to forbid changes in the attached collision objects.
We don't have that possibility in the RViz GUI either
and it might cause weird state effects in the GUI.
I would propose to add
msg_no_attached.attached_collision_objects.clear();
msg_no_attached.is_diff = true;
after the new variable definition here and below.
Renamed stuff, clang-formatted, and added the collision object remover, and local test looks good. A squash merge is preferred as there are too many commits 🔧. |
&MotionPlanningFrame::remoteUpdateCustomStartStateCallback, this); | ||
update_custom_goal_state_subscriber_ = | ||
nh.subscribe("/rviz/moveit/update_goal_state_RobotState", 1, | ||
&MotionPlanningFrame::remoteUpdateCustomGoalStateCallback, this); |
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.
You forgot to change the topic names (*_custom_*_state
), please do that too.
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.
Forgot to push that single commit, sorry.
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.
Ok, one last request for change. Otherwise this looks good and I'm happy to include it.
Please also look at clang-format again, the CI failed
if (first_time_) | ||
{ | ||
return; | ||
} |
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.
... which means getRobotInteraction()
is not a valid object yet, I guess.
Fair enough. Please add a comment that explains this reasoning above the if
here as well as in the lines below that trigger the lazy load.
Got it. Finished. |
Awesome, thank you for your endurance 👍 I approve to merge this into |
Should I rebase this or someone else is working on this 😂 ? |
@phy25 I'm working on merging this. |
- /rviz/moveit/update_custom_start_state - /rviz/moveit/update_custom_goal_state stopping from external: - /rviz/moveit/stop
Merged after rebase: 83809de, github didn't notice. |
- /rviz/moveit/update_custom_start_state - /rviz/moveit/update_custom_goal_state stopping from external: - /rviz/moveit/stop
Description
This PR derived from the idea in a ROS Answer question: Provide external topics setting the start state and the goal state in the MotionPlanningRvizPlugin with a RobotState object. This improves the current API in which the state can only be set with the current robot position.
To achieve this, two new topics are subscribed:
/rviz/moveit/update_custom_start_state
/rviz/moveit/update_custom_goal_state
What's more, for the completeness of the external API, stopping command is exposed too:
/rviz/moveit/stop
Finally, the state of allow_external_program UI checkbox can be kept across sessions now, in order to ease the usage. The slot function adds a init check, to prevent uninitialized error.
As I am new to MoveIt! and C++, any feedback is welcome. The feature has been tested locally, and I will complete the following checklist in a week, sorry about that.
Checklist