【问题描述】
这个问题发生使用多机通讯过程中,虽然能连接上下位机,而且有/odom话题发布,但是在接下来的一系列建图过程中出错,于是我检查tf_tree,就看到了这些错误。
PluginHandlerDirect._restore_settings() plugin "rqt_tf_tree/RosTfTree#0" raised an exception:
Traceback (most recent call last):
File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/plugin_handler_direct.py", line 116, in _restore_settings
self._plugin.restore_settings(plugin_settings_plugin, instance_settings_plugin)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_tf_tree/tf_tree.py", line 131, in restore_settings
self._refresh_tf_graph()
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_tf_tree/tf_tree.py", line 143, in _refresh_tf_graph
self._update_graph_view(self._generate_dotcode())
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_tf_tree/tf_tree.py", line 152, in _generate_dotcode
force_refresh=force_refresh)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_tf_tree/dotcode_tf.py", line 96, in generate_dotcode
data = yaml_parser.load(yaml_data)
File "/usr/local/lib/python2.7/dist-packages/yaml/__init__.py", line 114, in load
return loader.get_single_data()
File "/usr/local/lib/python2.7/dist-packages/yaml/constructor.py", line 66, in get_single_data
node = self.get_single_node()
File "/usr/local/lib/python2.7/dist-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/local/lib/python2.7/dist-packages/yaml/composer.py", line 58, in compose_document
self.get_event()
File "/usr/local/lib/python2.7/dist-packages/yaml/parser.py", line 118, in get_event
self.current_event = self.state()
File "/usr/local/lib/python2.7/dist-packages/yaml/parser.py", line 193, in parse_document_end
token = self.peek_token()
File "/usr/local/lib/python2.7/dist-packages/yaml/scanner.py", line 129, in peek_token
self.fetch_more_tokens()
File "/usr/local/lib/python2.7/dist-packages/yaml/scanner.py", line 223, in fetch_more_tokens
return self.fetch_value()
File "/usr/local/lib/python2.7/dist-packages/yaml/scanner.py", line 579, in fetch_value
self.get_mark())
ScannerError: mapping values are not allowed here
in "<string>", line 2, column 32:
=== Robot drivetrain parameters:
【问题解决】
猜测是不是因为有两个tf转换相冲突
目前没有找到确切原因,但是我把下位机中的 /ros_arduino_bridge/ros_arduino_python/config/my_arduino_params.yaml调成和上位机中的一模一样,结果就可以正常了,吃惊!
并且SLAM也可以正常建图了~
所以只是猜测有两个tf转换相冲突,大家不妨试一下。
也附上我的my_arduino_params.yaml,大家可以帮忙看一下这个问题到底出在哪里
# For a direct USB cable connection, the port name is typically
# /dev/ttyACM# where is # is a number such as 0, 1, 2, etc
# For a wireless connection like XBee, the port is typically
# /dev/ttyUSB# where # is a number such as 0, 1, 2, etc.
port: /dev/ttyACM0 #你要修改的部分,改为arduino板和上位机连接的串口号
baud: 57600
timeout: 0.1
rate: 50
sensorstate_rate: 10
use_base_controller: True #你要修改的部分 改为True
base_controller_rate: 10
# For a robot that uses base_footprint, change base_frame to base_footprint
base_frame: base_link
# === 这部分是车子的参数,比如轮子直径,减速比,编码器信息等,根据你自己的车子来修改
wheel_diameter: 0.065 #你要修改的部分
wheel_track: 0.125 #你要修改的部分
encoder_resolution: 8384 #你要修改的部分
gear_reduction: 1.0 #你要修改的部分
motors_reversed: False #你要修改的部分
# === PID 部分,控制轮速,修改到车子能够根据命令走直线且速度稳定
Kp: 10 #你要修改的部分
Kd: 12 #你要修改的部分
Ki: 0 #你要修改的部分
Ko: 50 #你要修改的部分
accel_limit: 1.0 #你要修改的部分
# === Sensor definitions. Examples only - edit for your robot.
# Sensor type can be one of the follow (case sensitive!):
# * Ping
# * GP2D12
# * Analog
# * Digital
# * PololuMotorCurrent
# * PhidgetsVoltage
# * PhidgetsCurrent (20 Amp, DC)
sensors: {
#motor_current_left: {pin: 0, type: PololuMotorCurrent, rate: 5},
#motor_current_right: {pin: 1, type: PololuMotorCurrent, rate: 5},
#ir_front_center: {pin: 2, type: GP2D12, rate: 10},
#sonar_front_center: {pin: 5, type: Ping, rate: 10},
arduino_led: {pin: 13, type: Digital, rate: 5, direction: output}
}