TechmanRobotInc / tmr_ros2

TM Robots supporting ROS2 drivers and some extended external applications. (experimental) (not support the new TM S-Series)
Other
41 stars 22 forks source link

tmr_driver keeps reconnecting #8

Open janandries opened 3 years ago

janandries commented 3 years ago

The driver in tmrlib keeps reconnecting, even after the connection is reported to be ok.

To reproduce:

Below the output of starting the listennode after the tmr_driver is started, which will produce the same behavior. I added printing of the return code from the sct_func function https://github.com/TechmanRobotInc/tmr_ros2/blob/d4841bb0fa3bf2aba1d55feb735949867ac2feea/tmr_driver/src/tmr_ros2_sct.cpp#L129

Output:

[ INFO] tmr::Communication::Communication [DEBUG] tmr::SBuffer::SBuffer [DEBUG] tmr::CommRecv::CommRecv [DEBUG] tmr::RobotState::RobotState [DEBUG] Create DataTable [ INFO] tmr::Communication::Communication [DEBUG] tmr::SBuffer::SBuffer [DEBUG] tmr::CommRecv::CommRecv [ INFO] TM_SVR: halt [ INFO] TM_SVR: start [ INFO] TM_COM: ip:=192.168.2.47 [ INFO] TM_COM: rv:=0 [ INFO] TM_COM: Connection is ok [ INFO] TM_COM: O_NONBLOCK connection is ok [ INFO] TM_COM: TM robot is connected. sockfd:=17 [INFO] [tmr_svr]: Publisher thread begin [ INFO] TM_SCT: halt [ INFO] TM_SCT: start [ INFO] TM_COM: ip:=192.168.2.47 [ INFO] TM Flow DataTable Checked Item: [ INFO] - Robot_Link - checked [ INFO] - Robot_Error - checked [ INFO] - Project_Run - checked [ INFO] - Project_Pause - checked [ INFO] - Safeguard_A - checked [ INFO] - ESTOP - checked [ INFO] - Camera_Light - checked [ INFO] - Error_Code - checked [ INFO] - Joint_Angle - checked [ INFO] - Coord_Robot_Flange - checked [ INFO] - Coord_Robot_Tool - checked [ INFO] - TCP_Force - checked [ INFO] - TCP_Force3D - checked [ INFO] - TCP_Speed - checked [ INFO] - TCP_Speed3D - checked [ INFO] - Joint_Speed - checked [ INFO] - Joint_Torque - checked [ INFO] - Project_Speed - checked [ INFO] - MA_Mode - checked [ INFO] - Robot_Light - checked [ INFO] - Ctrl_DO0 - checked [ INFO] - Ctrl_DO1 - checked [ INFO] - Ctrl_DO2 - checked [ INFO] - Ctrl_DO3 - checked [ INFO] - Ctrl_DO4 - checked [ INFO] - Ctrl_DO5 - checked [ INFO] - Ctrl_DO6 - checked [ INFO] - Ctrl_DO7 - checked [ INFO] - Ctrl_DI0 - checked [ INFO] - Ctrl_DI1 - checked [ INFO] - Ctrl_DI2 - checked [ INFO] - Ctrl_DI3 - checked [ INFO] - Ctrl_DI4 - checked [ INFO] - Ctrl_DI5 - checked [ INFO] - Ctrl_DI6 - checked [ INFO] - Ctrl_DI7 - checked [ INFO] - Ctrl_AO0 - checked [ INFO] - Ctrl_AI0 - checked [ INFO] - Ctrl_AI1 - checked [ INFO] - End_DO0 - checked [ INFO] - End_DO1 - checked [ INFO] - End_DO2 - checked [ INFO] - End_DO3 - checked [ INFO] - End_DI0 - checked [ INFO] - End_DI1 - checked [ INFO] - End_DI2 - checked [ INFO] - End_AI0 - checked [ INFO] - g_flow_dir - skipped [ INFO] Total 48 item,47 checked, 1 skipped [ INFO] TM_COM: rv:=-1 [ WARN] TM_COM: Connection timeout [ INFO] TM_COM: O_NONBLOCK connection is fail [INFO] [tmr_sct]: sct_response thread begin [INFO] [tmr_sct]: (TM_SCT): is not connected [INFO] [tmr_sct]: (TM_SCT) reconnect in [INFO] [tmr_sct]: (TM_SCT) connect(1000ms)... [ INFO] TM_COM: ip:=192.168.2.47 [ INFO] TM_COM: rv:=-1 [ WARN] TM_COM: Connection timeout [ INFO] TM_COM: O_NONBLOCK connection is fail [INFO] [tmr_sct]: (TM_SCT): is not connected [INFO] [tmr_sct]: (TM_SCT) reconnect in 3 sec...

... here I start the ListenNode in the TMFlow ...

[INFO] [tmr_sct]: (TM_SCT) connect(1000ms)... [ INFO] TM_COM: ip:=192.168.2.47 [ INFO] TM_COM: rv:=0 [ INFO] TM_COM: Connection is ok [ INFO] TM_COM: O_NONBLOCK connection is ok [ INFO] TM_COM: TM robot is connected. sockfd:=33 [ERROR] [tmr_sct]: Received communication feedback code: 3 [INFO] [tmr_sct]: (TM_SCT): sct_func returned false [INFO] [tmr_sct]: (TM_SCT) reconnect in 3 sec... [INFO] [tmr_sct]: (TM_SCT) connect(1000ms)... [ INFO] TM_COM: ip:=192.168.2.47 [ INFO] TM_COM: rv:=0 [ INFO] TM_COM: Connection is ok [ INFO] TM_COM: O_NONBLOCK connection is ok [ INFO] TM_COM: TM robot is connected. sockfd:=33 [ERROR] [tmr_sct]: Received communication feedback code: 3 [INFO] [tmr_sct]: (TM_SCT): sct_func returned false [INFO] [tmr_sct]: (TM_SCT) reconnect in 3 sec... [INFO] [tmr_sct]: (TM_SCT) connect(1000ms)... [ INFO] TM_COM: ip:=192.168.2.47

etc. etc.

As you can see the TM_COM prints out Connection is ok and that TM robot is conneted. sockfd:=33, but it returns a feedback code 3 (CommRC::NOTCONNECT) however, causing the tmr_sct driver to keep trying to reconnect.

janandries commented 3 years ago

is there any update on this? this is preventing the tmrlib from reconnecting properly when the ListenNode comes back online

Inserer-Pseudo commented 2 years ago

Hi there ! Same error here but starts immediatly after first connect. Did you manage to solve it ? I'lll try to on my own and keep you updated if I succeed. Bye

Inserer-Pseudo commented 2 years ago

I solved my issue, for those that are interested: