Arduino is ready. [INFO] [1683984140.630143]: Connected to Arduino on port /dev/ttyUSB0 at 115200 baud [INFO] [1683984140.651436]: arduino_led {'direction': 'output', 'type': 'Digital', 'rate': 5, 'pin': 13} published on topic /arduino/sensor/arduino_led Updating PID parameters Traceback (most recent call last): File "/home/nano/my_ws/src/ros_arduino_bridge/ros_arduino_python/nodes/arduino_node.py", line 226, in <module> myArduino = ArduinoROS() File "/home/nano/my_ws/src/ros_arduino_bridge/ros_arduino_python/nodes/arduino_node.py", line 142, in __init__ self.myBaseController = BaseController(self.controller, self.base_frame, self.name + "_base_controller") File "/home/nano/my_ws/src/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/base_controller.py", line 59, in __init__ self.ticks_per_meter = self.encoder_resolution * self.gear_reduction / (self.wheel_diameter * pi) TypeError: can't multiply sequence by non-int of type 'float'
时间: 2023-06-25 07:05:56 浏览: 176
这个错误是因为在 base_controller.py 文件的第 59 行中,有一个除法运算的结果是 float 类型,而在同一行中还有一个整数乘法运算。这两个运算的结果类型不同,导致了错误。可能的解决方法是将整数转换为浮点数,例如:
```
self.ticks_per_meter = float(self.encoder_resolution * self.gear_reduction) / (self.wheel_diameter * pi)
```
这样就可以避免类型不匹配的错误了。
相关问题
avrdude: ser_open(): can't open device "/dev/ttyUSB0": Permission denied如何解决
这个错误通常是因为你的用户没有访问串口设备的权限。你可以通过以下步骤解决这个问题:
1. 确认你的串口设备名称是 "/dev/ttyUSB0",如果不是,请替换为正确的设备名称。
2. 将你的用户添加到 dialout 组中。这可以通过以下命令实现:
```
sudo adduser <your_username> dialout
```
注意,你需要将 `<your_username>` 替换为你的实际用户名。
3. 然后重新启动你的电脑或注销并重新登录,以使更改生效。
4. 最后,使用 `ls -la /dev/ttyUSB0` 命令,确认你的用户已经具有访问串口设备的权限。
如果以上步骤仍然无法解决问题,请确保你的串口设备没有被其他程序占用,并确认你的Arduino板是否连接到计算机并已正确配置。
/dev/ttyUSB
/dev/ttyUSB是Linux系统中的一个设备文件,用于表示USB串口设备。在Linux系统中,串口设备通常以/dev/ttyUSB0、/dev/ttyUSB1等形式命名。这些设备文件可以用于与外部设备进行串口通信,例如与Arduino、传感器等进行数据交互。
/dev/ttyUSB是一种特殊的设备文件,它提供了对USB串口设备的访问权限。通过打开/dev/ttyUSB文件,可以向串口设备发送数据或从串口设备接收数据。在Linux系统中,可以使用各种编程语言(如C、C++、Python等)来编写程序,通过读写/dev/ttyUSB文件来实现与USB串口设备的通信。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)