ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ros_arduino_bridge reconnection error

asked 2016-10-30 22:08:01 -0500

sonictl gravatar image

updated 2016-11-03 06:05:28 -0500

Hi, when I

  • launch the "ros_arduino_python/arduino.launch"

I can perfectly control the base using "teleop_twist_keyboard" which is publishing the cmd_vel topic.

But When I shutdown the arduino.launch by pressing ctrl+c *and try to launch the ros_arduino_python/arduino.launch again, *I see the connection Exception. as below:

===============

Connecting to Arduino on port /dev/ARDUINOBASE ...
Serial Exception:
(<class 'serial.serialutil.SerialException'>, SerialException(), <traceback object at 0xb5f57a80>)
Traceback follows:
Traceback (most recent call last):
File "/root/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/arduino_driver.py", line 73, in connect
raise SerialException
SerialException
Cannot connect to Arduino!

=================

The error log is below:

root@pirobot:~# roslaunch ros_arduino_python arduino.launch
... logging to /root/.ros/log/8e8d6d00-9f12-11e6-b069-28f3667b4dc0/roslaunch-pirobot-2919.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://pirobot:37235/

SUMMARY
========

PARAMETERS
 * /arduino/Kd: 12
 * /arduino/Ki: 0
 * /arduino/Ko: 50
 * /arduino/Kp: 10
 * /arduino/accel_limit: 1.0
 * /arduino/base_controller_rate: 10
 * /arduino/base_frame: base_link
 * /arduino/baud: 57600
  * /arduino/encoder_resolution: 2200
  * /arduino/gear_reduction: 1.0
  * /arduino/motors_reversed: False
  * /arduino/port: /dev/ARDUINOBASE
  * /arduino/rate: 50
  * /arduino/sensors/arduino_led/direction: output
  * /arduino/sensors/arduino_led/pin: 13
  * /arduino/sensors/arduino_led/rate: 5
  * /arduino/sensors/arduino_led/type: Digital
  * /arduino/sensorstate_rate: 10
  * /arduino/timeout: 0.1
  * /arduino/use_base_controller: True
  * /arduino/wheel_diameter: 0.08
  * /arduino/wheel_track: 0.36
  * /rosdistro: indigo
  * /rosversion: 1.11.20

 NODES
 /
 arduino (ros_arduino_python/arduino_node.py)

 ROS_MASTER_URI=http://pirobot:11311

 core service [/rosout] found
 process[arduino-1]: started with pid [2937]
 Connecting to Arduino on port /dev/ARDUINOBASE ...
 Serial Exception:
 (<class 'serial.serialutil.SerialException'>, SerialException(), <traceback object at 0xb5f57a80>)
 Traceback follows:
 Traceback (most recent call last):
 File "/root/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/arduino_driver.py", line 73, in connect
 raise SerialException
 SerialException
 Cannot connect to Arduino!
 [arduino-1] process has died [pid 2937, exit code 1, cmd /root/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/nodes/arduino_node.py __name:=arduino __log:=/root/.ros/log/8e8d6d00-9f12-11e6-b069-28f3667b4dc0/arduino-1.log].
 log file: /root/.ros/log/8e8d6d00-9f12-11e6-b069-28f3667b4dc0/arduino-1*.log
 all processes on machine have died, roslaunch will exit
 shutting down processing monitor...
 ... shutting down processing monitor complete
 done
edit retag flag offensive close merge delete

Comments

I'm using ros_indigo

sonictl gravatar image sonictl  ( 2016-10-30 22:08:56 -0500 )edit

I guess that's because I used Ctrl+C to terminate the arduino.launch, should I always use Ctrl+Z? is there any possible solution about editing the python code? thank you!!

sonictl gravatar image sonictl  ( 2016-10-30 23:59:28 -0500 )edit

Ctrl-C is correct. Ctrl-Z would put the launch process in the background. Can you please make sure you are (a) using the indigo-dev branch of the ros_arduino_bridge package and (b) do a 'git pull' to make sure you have the latest updates?

Pi Robot gravatar image Pi Robot  ( 2016-10-31 08:50:33 -0500 )edit

is there any methods that I can check the version of my code? thx!! below is my commands: $ cd ~/catkin_ws/src $ git clone https://github.com/hbrobotics/ros_ard... $ cd ros_arduino_bridge $ git checkout indigo-devel $ cd ~/catkin_ws $ catkin_make $ source ~/catkin_ws/devel/setup.bash

sonictl gravatar image sonictl  ( 2016-10-31 23:07:52 -0500 )edit

That all looks correct. Can you try checking out the master branch to see if that improves the serial connection?

Pi Robot gravatar image Pi Robot  ( 2016-11-01 18:17:13 -0500 )edit

I can terminate it by Ctrl+C and start it again smoothly when using master branch:

sonictl gravatar image sonictl  ( 2016-11-02 08:38:30 -0500 )edit

The last test used another Arduino board(made in italy). It works well even in indigo-level. The Arduino board with which the error occurs is made in China and it will be shown as /dev/ttyUSB0 rather than this /dev/ttyACM0. I guess that's the reason: ttyUSB* vs ttyACM*

sonictl gravatar image sonictl  ( 2016-11-02 08:50:13 -0500 )edit

Hi @Pi Robot,

there is another problem i need your advise: thank you! http://answers.ros.org/question/24692...

sonictl gravatar image sonictl  ( 2016-11-02 08:56:05 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-11-22 01:26:08 -0500

sonictl gravatar image

updated 2016-11-22 01:28:00 -0500

ros_arduino_bridge indigo-devel branch , has bug, which result in this reconnection probelm.

I solved this problem by switching to master branch. and catkin_make again.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-10-30 22:08:01 -0500

Seen: 463 times

Last updated: Nov 22 '16