You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should try to wrap the functions we redefine in DTROS in the original rospy module.
Example, we want to use self.Publisher() instead of rospy.Publisher(), we can do something like this:
def wrapPublisher([args_for_rospy_Publisher]):
print('WARNING: Your are using rospy.Publisher, use self.Publisher instead')
return rospy._Publisher([args_for_rospy_Publisher])
rospy._Publisher = rospy.Publisher
rospy.Publisher = wrapPublisher
If we do this in DTROS.__init__(), then we can catch cases where we forget to use self.Publisher() instead of rospy.Publisher(). Everything will still work fine but at least we get a Warning.
The text was updated successfully, but these errors were encountered:
@afdaniele I think that is a good idea, but complicates the code and will throw unnecessary warnings in the case that someone intentionally wants to use a publisher or subscriber that are not deactivated by the switch
Just something to keep in mind.
The easy fix to that would be
def wrapPublisher([args_for_rospy_Publisher], permanent=False):
if not permanent:
print('WARNING: Your are using rospy.Publisher, use self.Publisher instead')
return rospy._Publisher([args_for_rospy_Publisher])
We should try to wrap the functions we redefine in DTROS in the original rospy module.
Example, we want to use
self.Publisher()
instead ofrospy.Publisher()
, we can do something like this:If we do this in
DTROS.__init__()
, then we can catch cases where we forget to useself.Publisher()
instead ofrospy.Publisher()
. Everything will still work fine but at least we get a Warning.The text was updated successfully, but these errors were encountered: