在NAV2中,编辑URDF文件后,进行运行,提示:
Unable to parse component [${-(wheel_radius+wheel_zoff)}] to a double (while parsing a vector value)
是由于URDF文件使用了宏,而在加载时没有指定使用宏的定义。
老代码(报错的代码):
urdf = os.path.join(gps_wpf_dir, 'urdf', 'scout_mini_algo.urdf')
with open(urdf, 'r') as infp:
robot_description = infp.read()
launch_ros.actions.Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='both',
parameters=[{'robot_description': robot_description}]
),
改为新代码:
urdf = os.path.join(gps_wpf_dir, 'urdf', 'scout_mini_algo.urdf')
launch.actions.DeclareLaunchArgument(name='robotmodel', default_value=urdf,