ROSCONSOLE_FORMAT not working in ROSPY on Hydro
I tried to use ROSCONSOLE_FORMAT as shown in Console Output Formatting on rosconsole wiki.
I configured my .bashrc as shown below:
source /opt/ros/hydro/setup.bash
source ~/myproject/devel/setup.bash
export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=<removed_link>
export ROBOT=sim
export ROSCONSOLE_FORMAT='[${severity}] [${node}@${function}:${line}]: ${message}'
For C++ I get expected outputs. However for any python program, for example
#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
def talker():
# pub = rospy.Publisher('chatter', String, queue_size=10)
rospy.init_node('talker', anonymous=True)
r = rospy.Rate(1) # 10hz
while not rospy.is_shutdown():
# str = "hello world %s" % rospy.get_time()
rospy.loginfo("Hello World!")
# pub.publish(str)
r.sleep()
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass
I get unformatted outputs like:
mjyc@ubuntu:~$ python test.py
[INFO] [WallTime: 1405812621.854884] Hello World!
[INFO] [WallTime: 1405812622.856649] Hello World!
[INFO] [WallTime: 1405812623.856340] Hello World!
[INFO] [WallTime: 1405812624.856789] Hello World!
[INFO] [WallTime: 1405812625.855262] Hello World!
Anybody has any clue?
I'm on Ubuntu 12.04 and using hydro.
FYI: ros_comm/pull/519 adds support for
ROSCONSOLE_FORMAT
torospy
. It's currently only merged intoindigo-devel
though.