获取ros信息的命令
# 设置间隔时间
stdbuf -oL ros2 topic echo /common_state \
| grep --line-buffered -E 'batterynum:|current:|voltage:' \
| awk -v interval=0 ' # 设置间隔时间
BEGIN{last=0}
{
if (systime() - last >= interval) {
print strftime("%Y-%m-%d %H:%M:%S"), $0
last=systime()
fflush()
}
}'
# 不设置间隔时间
# 先 source 环境(如未 source)
source iben_ws/install/setup.bash
ros2 topic echo /common_state \
| grep --line-buffered -E 'batterynum:|current:|voltage:' \
| awk '{print strftime("%Y-%m-%d %H:%M:%S"), $0}'

浙公网安备 33010602011771号