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

Added status topic to indicate which mux channel is selected and if l… #20

Open
wants to merge 3 commits into
base: melodic-devel
Choose a base branch
from

Conversation

Michael-Equi
Copy link

@Michael-Equi Michael-Equi commented May 28, 2020

Added status topic to indicate which mux channel is selected and if lock is active

@@ -157,6 +166,13 @@ bool TwistMux::hasPriority(const VelocityTopicHandle& twist)
priority = velocity_priority;
velocity_name = velocity_h.getName();
}
} else if(last_pub_name_ == velocity_h.getName() &&
(pub_status_continuously_ || last_locked_name_ != velocity_h.getName())) {
Copy link
Member

Choose a reason for hiding this comment

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

please match the style of this file and drop that { to the next line

@bmagyar
Copy link
Member

bmagyar commented Jun 1, 2020

@Timple @doisyg could you guys please provide your review here, would this be useful to you too? Could you please also give it a test, I currently don't have a setup where I could properly test it

.gitignore Outdated
@@ -1 +1,2 @@
*.pyc
/cmake-build-debug/
Copy link
Member

Choose a reason for hiding this comment

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

please don't add custom stuff here

@@ -82,7 +83,9 @@ class TwistMux
boost::shared_ptr<velocity_topic_container> velocity_hs_;
boost::shared_ptr<lock_topic_container> lock_hs_;

ros::Publisher cmd_pub_;
ros::Publisher cmd_pub_, status_pub_;
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't it be handier to add a new message that contains these two strings and publish that?

Copy link
Author

Choose a reason for hiding this comment

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

I usually try to avoid adding custom messages for stuff like this. Unless you really believe that a new message type is the best way to go and don't like the current implementation of two topics, I'm thinking it might be better to either concatenate the strings with an easily parse-able delimiter or potentially use something like the diagnostics messages.

Copy link
Author

Choose a reason for hiding this comment

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

I made the other couple small changes, let me know what you think the best course of action is on this. Unfortunately I no longer have a melodic setup with ROS1 so I may not be able to make + test any major modifications anytime soon.

@Timple
Copy link

Timple commented Jun 2, 2020

I don't have a need for this feature, but I'm willing to review.

@Michael-Equi
Copy link
Author

Sorry I have not gotten back to this PR in a bit. Ill try to make some of the suggested modifications this weekend.

@@ -61,6 +63,7 @@ TwistMux::TwistMux(int window_size)

/// Publisher for output topic:
cmd_pub_ = nh.advertise<geometry_msgs::Twist>("cmd_vel_out", 1);
status_pub_ = nh.advertise<std_msgs::String>("out_status", 5, true);
Copy link

@Timple Timple Jun 2, 2020

Choose a reason for hiding this comment

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

Just "status" is enough, "status in" is quite rare for nodes.

{
cmd_pub_.publish(*msg);
if(pub_status_continuously_ || name != last_pub_name_){
Copy link

Choose a reason for hiding this comment

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

Also here, { on next line

{
cmd_pub_.publish(*msg);
if(pub_status_continuously_ || name != last_pub_name_){
Copy link

Choose a reason for hiding this comment

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

Ah, I see here why the param is appended with continuously. Sorry I missed that part, than the parameter name does make sense!

But why publish a topic continuously when the data does not change? This is exactly what latched topics are for!

Copy link
Author

Choose a reason for hiding this comment

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

That mostly had to do with my application at the moment of writing this. I had it going through a ROS1 bridge to ROS2 which meant latching did not work for me so I had to get around it with that solution. I can probably remove it now since that specific application is no longer something I need.

Copy link

Choose a reason for hiding this comment

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

Thanks, it's probably nicer not to modify all nodes for a shortcoming in
the bridge :)

@Timple
Copy link

Timple commented Jul 13, 2020

Ah, sorry. I've reviewed this a while back. But apparently you have to close the review in order for the comments to show up...
I've hit publish now.

Main item: make the status a latched topic and you can drop the whole 'continuously' part.

@chrisl8
Copy link

chrisl8 commented Aug 19, 2020

Any update on this? I'd like to use it. Thanks!

@Timple
Copy link

Timple commented Aug 24, 2020

No updates, my last comment is still valid.
Not sure if @Michael-Equi has any intention of implementing the latched topics.
Feel free to implement that part yourself and open a seperate PR.

@Michael-Equi
Copy link
Author

@chrisl8 Its not looking like I will have time to implement that anytime soon. I am also no longer using ROS1 as my team has fully transitioned our robot to ROS2 which makes it a bit harder to work on this.

@chrisl8
Copy link

chrisl8 commented Aug 24, 2020

@Michael-Equi Which package, if any, are you using for command input mux on ROS2.

@Timple Sounds good. I'll give it a try soon if I can find time.

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.

4 participants