How can I stop printing statements from moveit_commander Python?
Hi, I have a code here made using moveitcommander and I am using RL for training a UR5. I obtain pose and joint angle values by running the moveitcommander interface and publishing those values in a rostopic so that I can subscribe it in my environment. But due to the training overload, the publishers seem to crash and the whole training process stops. My idea is to somehow incorporate the moveitcommander within the environment itself so that I can get rid of publishers and subscribers. The problem with moveit-commander is that whenever you initialze the moveitcmmander interface and run the python code it starts printing these statements.
[ INFO] [1574631433.496141382]: Loading robot model 'ur5_r2'...
[ WARN] [1574631433.497492371]: Skipping virtual joint 'fixed_base' because its child frame 'base_link' does not match the URDF frame 'world'
[ INFO] [1574631433.497565114]: No root/virtual joint specified in SRDF. Assuming fixed joint
[ INFO] [1574631433.696682137, 7.780000000]: Loading robot model 'ur5_r2'...
[ WARN] [1574631433.696776037, 7.782000000]: Skipping virtual joint 'fixed_base' because its child frame 'base_link' does not match the URDF frame 'world'
[ INFO] [1574631433.696798683, 7.782000000]: No root/virtual joint specified in SRDF. Assuming fixed joint
I somehow want to edit this and stop printing these boiler statements. Is there a way to do this? because these statements will significantly slower the training process.
Asked by mkb_10062949 on 2019-11-24 16:58:26 UTC
Answers
See here:
http://wiki.ros.org/roscpp/Overview/Logging
In brief:
Set...
export ROSCONSOLE_FORMAT='${logger}: ${message}'
Now you can see which nodes the messages are coming from. Then...
sudo vi ~/.rosconsole.yaml
Add the following:
log4j.logger.ros=DEBUG
Then back at the command line:
export ROSCONSOLE_CONFIG_FILE=~/.rosconsole.yaml
This will turn on ALL debugging! But...
To turn off debugging on over-zealous nodes, add them to the ~/.rosconsole.yaml file, like this:
log4j.logger.ros.roscpp=INFO
Now DEBUG statements for roscpp will not be seen. You can suppress any number of nodes by just adding more lines to the file. You can get quite specific, eg.
log4j.logger.ros.move_base.pluginlib.ClassLoader=INFO
Asked by jordan on 2019-11-24 19:56:49 UTC
Comments
Hi thank you for your answer, unfortunately it didin't work.
Asked by mkb_10062949 on 2019-11-25 04:05:13 UTC
Do you have any other suggestions please?
Asked by mkb_10062949 on 2019-11-25 04:05:46 UTC
export ROSCONSOLE_FORMAT='${logger}: ${message}'
You mentioned that I will get the nodes which are printing the messages but I ran this line and didn't get anythin
Asked by mkb_10062949 on 2019-11-25 04:07:12 UTC
Did you just run the command and expected to have the infos or do you have launched your nodes again and checked the output ? (also did you ensure to run them in the same terminal ?)
Asked by Delb on 2019-11-25 04:30:07 UTC
@jordan's answer is correct, personnaly I don't export the variable I prefer to do it in the launch file for more clarity, at the begging you can add this line :
<env name="ROSCONSOLE_CONFIG_FILE" value="PATH_TO_YOUR_CONFIG_FILE"/>
Asked by Delb on 2019-11-25 04:33:24 UTC
Okay i found it, the messages are coming from ros.moveit_core.robot_model
what is the syntax to add this to the rosconsole.yaml file ? I mean how should write it?
Asked by mkb_10062949 on 2019-11-25 04:52:23 UTC
That's exactly the smae output as ${logger}
, with the logger prefix, set it to any logger level above INFO ( WARN, ERROR or FATAL)
:
log4j.logger.ros.moveit_core.robot_model=WARN
Asked by Delb on 2019-11-25 04:58:18 UTC
okay I did this and I exported, I also tried exporting the logger value as FATAL and ERROR but it still prints these statements
ros.moveit_core.robot_model: Loading robot model 'ur5_r2'...
ros.moveit_core.robot_model: Skipping virtual joint 'fixed_base' because its child frame 'base_link' does not match the URDF frame 'world'
ros.moveit_core.robot_model: No root/virtual joint specified in SRDF. Assuming fixed joint
ros.moveit_core.robot_model: Loading robot model 'ur5'...
ros.moveit_core.robot_model: Skipping virtual joint 'fixed_base' because its child frame 'base_link' does not match the URDF frame 'world'
ros.moveit_core.robot_model: No root/virtual joint specified in SRDF. Assuming fixed joint
Asked by mkb_10062949 on 2019-11-25 05:09:24 UTC
You still have this ouput after exporting ROSCONSOLE_CONFIG_FILE
to your conf file ? Do you run the nodes in te same terminal (the terminal where you have exported the variable) ?
Asked by Delb on 2019-11-25 05:13:06 UTC
Please provide a copy of your config file. Also, provide the output of 'env' (type 'env' in the terminal).
Asked by jordan on 2019-11-25 09:19:33 UTC
There was a typo in the original answer (missing period):
export ROSCONSOLE_CONFIG_FILE=~/rosconsole.yaml
Should be:
export ROSCONSOLE_CONFIG_FILE=~/.rosconsole.yaml
I edited the answer to correct it.
Asked by jordan on 2019-11-25 09:27:19 UTC
Comments
cross-posted: ros-planning/moveit#1774.
Asked by gvdhoorn on 2019-11-25 05:05:20 UTC