EAIBOT / dashgo

Apache License 2.0
31 stars 24 forks source link

有关于一个启动dashgo驱动节点的问题 #2

Open P2Tree opened 7 years ago

P2Tree commented 7 years ago

您好,我正在调试驱动节点,配置了ros环境后,连接PC与底盘,启动roscore,运行:

roslaunch dashgo_bringup  minimal.launch 

返回提示如下:(主要错误信息)

Connecting to Arduino on port /dev/dashgo ...
Traceback (most recent call last):
  File "/home/ubuntu/dashgo_ws/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 692, in <module>
    myArduino = ArduinoROS()
  File "/home/ubuntu/dashgo_ws/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 661, in __init__
    self.controller.connect()
  File "/home/ubuntu/dashgo_ws/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 104, in connect
    test = self.get_baud()
  File "/home/ubuntu/dashgo_ws/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 297, in get_baud
    return int(self.execute('b'));
  File "/home/ubuntu/dashgo_ws/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 214, in execute
    return int(value)
ValueError: invalid literal for int() with base 10: 'b'
[INFO] [WallTime: 1478876513.890813] Stopping the robot...
[INFO] [WallTime: 1478876513.891569] Shutting down Arduino Node...

请问一下,可能的原因是什么?我检查了一下代码,直接问题是出现在当向arduino发送读取波特率指令时,返回了'b',然后出错,是我使用上的问题吗? 谢谢!

P2Tree commented 7 years ago

我之后又用串口助手试了一下,发送:b,接收到的如下:

b
111111111111

111111111111
115200

111111111111

我不太清楚回显b是正常的吗?还有连着的3串1是什么意思?

ferstar commented 7 years ago

@PWESiberiaBear @EAIBOT 我这里也是类似的问题, 发送b\r收到的是一堆11111, 很奇葩

P2Tree commented 7 years ago

@ferstar 我后来通过微信联系到了公司的技术,给我发了一个底盘arduino的更新程序,我按照里边的说明更新后就可以通信了。我刚才试了一下,不再显示一串1,正常返回115200。 所以,你从淘宝上联系一下卖家,他们会给你找技术要程序,或者你给我发邮件dicksonliuming@gmail.com,我可以把我的更新程序发给你,但不保证是最新程序,只是通信这块是可以用的。

seanXYZ commented 7 years ago

我也遇到了一样的问题 请转发我邮箱 xiaoyong_z@126.com 不胜感激

seanXYZ commented 7 years ago

已经连接成功, 不过退出之后重连要重新插拔USB线

ferstar commented 7 years ago

@seanXYZ

邮件已发, 另外重新插拔线是不需要的 https://github.com/EAIBOT/dashgo/blob/basic_02/dashgo_bringup/startup/create_dashgo_udev.sh

P2Tree commented 7 years ago

确实可以通过用这个脚本绑定设备来实现,我在使用中,因为最近解决了底盘声音的问题,过程中遇到这样个问题。正常使用时,底盘意外断电后,将节点C^c结束后,再给底盘上电,可以查到设备里有dashgo,重启节点,仍无法连接到arduino,只能重启PC,感觉很不方便。

seanXYZ commented 7 years ago

@PWESiberiaBear same problem! 只能重启

ferstar commented 7 years ago

@seanXYZ @PWESiberiaBear 没必要重启的啊

service udev reload
sleep 2
service udev restart

即可

seanXYZ commented 7 years ago

@ferstar 我的 情况具体如下: sean@PC:/etc/udev/rules.d$ cat dashgo.rules KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0666", GROUP:="dialout", SYMLINK+="dashgo"

KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666", GROUP:="dialout", SYMLINK+="flashlidar"

然后按照你的操作: sean@PC:~/catkin_eai$ sean@PC:~/catkin_eai$ sudo usermod -a -G dialout sean sean@PC:~/catkin_eai$ sudo service udev reload sean@PC:~/catkin_eai$ sleep 2 sean@PC:~/catkin_eai$ sudo service udev restart udev stop/waiting udev start/running, process 12377 sean@PC:~/catkin_eai$

最后尝试: sean@PC:~/catkin_eai$ sean@PC:~/catkin_eai$ roslaunch dashgo_bringup minimal.launch ... logging to /home/sean/.ros/log/61997b2e-c274-11e6-95c3-346895aade7d/roslaunch-PC-12379.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://PC:35921/

SUMMARY

PARAMETERS

NODES / arduino (dashgo_bringup/dashgo_driver.py)

auto-starting new master process[master]: started with pid [12391] ROS_MASTER_URI=http://localhost:11311

setting /run_id to 61997b2e-c274-11e6-95c3-346895aade7d process[rosout-1]: started with pid [12404] started core service [/rosout] process[arduino-2]: started with pid [12415] [DEBUG] [WallTime: 1481771579.901167] init_node, name[/arduino], pid[12415] [DEBUG] [WallTime: 1481771579.901671] binding to 0.0.0.0 0 [DEBUG] [WallTime: 1481771579.901995] bound to 0.0.0.0 39121 [DEBUG] [WallTime: 1481771579.902565] ... service URL is rosrpc://PC:39121 [DEBUG] [WallTime: 1481771579.902863] [/arduino/get_loggers]: new Service instance [DEBUG] [WallTime: 1481771579.905437] ... service URL is rosrpc://PC:39121 [DEBUG] [WallTime: 1481771579.905824] [/arduino/set_logger_level]: new Service instance Connecting to Arduino on port /dev/dashgo ... Traceback (most recent call last): File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 703, in myArduino = ArduinoROS() File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 661, in init self.controller.connect() File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 104, in connect test = self.get_baud() File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 297, in get_baud return int(self.execute('b')); File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 214, in execute return int(value) TypeError: int() argument must be a string or a number, not 'NoneType' [INFO] [WallTime: 1481771587.137678] sean: Stopping the robot... [INFO] [WallTime: 1481771588.139649] Serial port closed. [arduino-2] process has finished cleanly log file: /home/sean/.ros/log/61997b2e-c274-11e6-95c3-346895aade7d/arduino-2*.log ^C[rosout-1] killing on exit [master] killing on exit shutting down processing monitor... ... shutting down processing monitor complete done sean@PC:~/catkin_eai$

seanXYZ commented 7 years ago

此外,还发现有个现象: 我用树莓派的wringPi库,连接dashgo的底盘时,一般都连接不上.但是用minicom -b 115200 -D /dev/ttyUSB0 就可以,而且通讯都正常,可以控制小车.这个现象跟我们讨论的连接问题应该是同一个问题.每次我连接dashgo 不成功时,我尝试minicom, 都可成功连接. 希望以上信息能对大家解决问题有所帮助~谢谢

P2Tree commented 7 years ago

各位,dashgo D1的底盘噪声比较大,我最近用了一种硬件方法,把声音基本消除了,只剩下一些机械安装的噪声,官方不提供底盘arduino的源代码,如果有源代码只需要修改一个参数就行,没办法只好硬件消除。现在在0.2以下的速度行驶,基本没有电气引起的噪声。 另外,重启的问题还是解决不了,依然需要重启,可能和我的设置有关,还在摸索。我使用的是X86的minipc搭建ROS来完成与底盘的通信。

ferstar commented 7 years ago

@seanXYZ 你这是底盘固件有问题啊, 我应该给你发了固件, 刷一下就好了

Connecting to Arduino on port /dev/dashgo ...
Traceback (most recent call last):
File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 703, in 
myArduino = ArduinoROS()
File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 661, in init
self.controller.connect()
File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 104, in connect
test = self.get_baud()
File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 297, in get_baud
return int(self.execute('b'));
File "/home/sean/catkin_eai/src/dashgo/dashgo_bringup/nodes/dashgo_driver.py", line 214, in execute
return int(value)
TypeError: int() argument must be a string or a number, not 'NoneType'

报这个错是因为init()py驱动要先给底盘发一个b也就是查询波特率的指令, 正常的情形是要返回具体波特率的, 然而你这个底盘固件有问题, 并没有返回期待的结果, 所以会报错, 你最好把给你发的底盘固件刷一下

ferstar commented 7 years ago

@PWESiberiaBear 我观察底盘噪音大的问题貌似是由于PWM值是从0慢慢爬升到设定值造成的, 确实需要改进底盘程序才行. 不知道你硬件是怎么消除的? 另外我这边确实不需要重启, ROS master 用的是ordroid xu4 Ubuntu 16.04

seanXYZ commented 7 years ago

@ferstar 好几位兄弟给我邮箱发了固件, 你的还没试过. 我马上试试看

seanXYZ commented 7 years ago

@ferstar  固件烧进去了, 但是还是没有用. 我的底盘可能跟你们的不一样(最近买的). 我的底盘是那种: 有三个USB口,没有HDMI接口的那种.跟官网有一点的区别, 不知道里面是不是一样的~   新固件倒是可以解决@PWESiberiaBear 所说的有111111返回的问题, 对于重新连接, 没什么改善

seanXYZ commented 7 years ago

此外,我感觉dashgo 的噪声应该会影响续航. @PWESiberiaBear  有测试过吗?

P2Tree commented 7 years ago

没有准确测试过,但现在无噪声后,确实感觉用的比较久一些,昨晚使用小车行走了一段时间,电压稳在12.5没有掉下去,之前噪声大时用20分钟以内就会调到11V,另外, @ferstar 噪声的问题是因为arduino输出给电机驱动板的PWM是125Hz载波,125会在电机上引入机械震动导致噪声,我做了一块板子,将125提升到20kHz载波频率,保证占空比不变,这样同样能驱动电机,但20kHz的载波引入的机械噪声已经基本超出听觉波段,如果在arduino里能直接修改频率,可以省掉硬件的事。其实从根本上来说,是因为dashgo d1的底盘机械上做的比较粗糙,里边的轴承座安装的也不精密,也会产生噪声。 @seanXYZ 我的底盘dashgo d1只有一个外接的usb口,另有5V 12V接线端子,黑色圆柱体车身,差动胶轮。

seanXYZ commented 7 years ago

@PWESiberiaBear 谢谢~ 如果你搞定重复连接问题的话,请教教我~ 请EAI的工程师修改频率试试啊~

P2Tree commented 7 years ago

联系了,那边的工程师不同意修改,没办法而为之了,现在20k,2以下的速度跑起来基本静音。另外,重复连接问题是啥?

ferstar commented 7 years ago

@PWESiberiaBear 兄台高人啊, 我根本没考虑过PWM频率

seanXYZ commented 7 years ago

@PWESiberiaBear 重复连接问题貌似是底盘里面的板子兼容性不好, cp210x的串口挺好用的, 但ch340的不好用. Dashgo 的就是ch340的.

P2Tree commented 7 years ago

嗯,找一下原因吧,好像你用的底盘和我的不一样,所以不知道协议一样不一样,抓一下串口通信的包,解析看看。 @seanXYZ

seanXYZ commented 7 years ago

@PWESiberiaBear 他们给我换了dashgo里面的mega2560新板子, 可以重复连接了

P2Tree commented 7 years ago

新板子和旧板子有什么区别吗?是程序不同还是硬件不同?

seanXYZ commented 7 years ago

@ferstar 这个问题应该你来回答了

seanXYZ commented 7 years ago

@PWESiberiaBear 类似dashgo 底盘的源代码 https://github.com/hbrobotics/ros_arduino_bridge/tree/indigo-devel/ros_arduino_firmware/src/libraries/ROSArduinoBridge

P2Tree commented 7 years ago

谢谢谢谢,我回头看看,最近没有仔细研究底盘了,在搞应用 @seanXYZ

seanXYZ commented 7 years ago

虽然给我换了板子之后, 偶尔还是出现重连的问题。 我已经用cpp把节点重写了(还没写完),完全没有重新连接的问题了! 看来还是代码有问题~ @PWESiberiaBear

P2Tree commented 7 years ago

哦哦,是哪个节点?arduino节点吗?

seanXYZ commented 7 years ago

@PWESiberiaBear 是的

HackaDong commented 6 years ago

@PWESiberiaBear 请问可以给我发一份固件吗,342167339@qq.com,感谢