2024-05-28 18:17:12 发布
网友
我在目标位置的输入是:
<param name="goal_location" value="2,-1.5"/>
我想得到一个位置(x,y)输入到一个元组中:
goal_location = tuple(map(int, rospy.get_param('/goal_location').split(',')))
引发的错误是:
ValueError: invalid literal for int() with base 10: '-1.5'
谢谢!你知道吗
您收到的'-1.5'字符串值无法转换为int请尝试float:
'-1.5'
int
float
goal_location = tuple(map(float, rospy.get_param('/goal_location').split(',')))
输出为:
(2.0, -1.5)
您收到的
'-1.5'
字符串值无法转换为int
请尝试float
:输出为:
相关问题 更多 >
编程相关推荐