TechmanRobotInc / tmr_ros1

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

The `tm_driver` fails to communicate with a TM12 #4

Closed spd-intermodalics closed 2 years ago

spd-intermodalics commented 3 years ago

Failure on communication with TM12

I need some assistance to find out why I cannot communicate properly with TM12. Please, read the Setup section to know whether there is a missing step that I overlooked, and the Errors section to see how TM Driver reports the error.

Setup

I have a TM12 with its control box up and running, configured properly to manually run.

Network setup

Let's say that the Ethernet interface where the TMFlow sets the Ethernet Listener server is connected to a client PC which runs Ubuntu 18.04 and ROS melodic. The ethernet network card of client PC and the ethernet interface of the controller are set correctly in the same subnet:

client PC: 192.168.x.1 and control box: 192.168.x.105. A check that passes OK is that client PC can ping and receive answer from control box.

In the controller PC, the settings for the ethernet slave has been setting according to the documentation in the read me, including settings exactly the same list of data to report, creating a project with Listener as the main component, and starting the ethernet server reporting (Status: Enabled) and showing in the log a message:

[<timestamp>] Ethernet Slave opens on: 192.168.x.105:5891

A check that passes OK is that client PC can manually connect to that port with nc 192.168.x.105 and a stream of binary data arrives properly. Also when opting for String or for Json the stream of data changes the serialization and can be human readable properly.

Launching tm_driver

In client PC the software of this repository is compiled, after manually needing to patch the package.xml to add the commented out packages (not sure why they are commented out when CMakeLists.txt requires them). The robot description is launched in client PC and then the tm_driver is launched in client PC against its own ROS core.

roslaunch tm12_description tm12_upload.launch

and then:

roslaunch tm_driver tm12_bringup.launch robot_ip:=192.168.x.105

Errors

In Binary mode

The result of the second command logs:

process[tm_driver-2]: started with pid [26156]
[ INFO] [1606142806.442577147]: TM_ROS: robot_ip:=192.168.x.105
[ INFO] [1606142806.442611108]: TmCommunication::TmCommunication
[ INFO] [1606142806.442641005]: TmCommunication::TmCommunication
[ INFO] [1606142806.446168895]: TM_ROS: set base_frame to base
[ INFO] [1606142806.447201083]: TM_ROS: set tool_frame to tool0
[ INFO] [1606142806.447221986]: TM_DRV: halt
[ INFO] [1606142806.447232141]: TM_DRV: start
[ INFO] [1606142806.447239719]: TM_SVR: start
[ INFO] [1606142806.447261063]: TM_COM: ip:=192.168.x.105
[ INFO] [1606142806.447652459]: TM_COM: rv:=0
[ INFO] [1606142806.447666420]: TM_COM: Connection is ok
[ INFO] [1606142806.447675202]: TM_COM: O_NONBLOCK connection is ok
[ INFO] [1606142806.447685266]: TM_COM: TM robot is connected. sockfd:=10
[ INFO] [1606142806.447710346]: $TMSVR,24,Play,2,Stick_PlayPause=1,*11

[ INFO] [1606142806.447733539]: TM_SCT: start
[ INFO] [1606142806.447749399]: TM_COM: ip:=192.168.x.105
[ INFO] [1606142811.470569198]: TM_COM: rv:=-1
[ WARN] [1606142816.476277714]: TM_COM: Connection timeout
[ INFO] [1606142816.476411965]: TM_COM: O_NONBLOCK connection is fail
[ INFO] [1606142816.495713197]: TM_ROS: publisher thread begin
[ INFO] [1606142816.495872511]: TM_ROS: (TM_SVR): (Play) (0) ModeError;Stick_PlayPause
[ INFO] [1606142816.546066786]: TM_ROS: sct_response thread begin
[ INFO] [1606142816.546197037]: TM_ROS: (TM_SCT): is not connected
[ INFO] [1606142816.546235030]: TM_ROS: (TM_SCT) reconnect in 
[ INFO] [1606142816.546272553]: 3.0 sec...
[ INFO] [1606142817.754346525]: 2.0 sec...
[ INFO] [1606142818.964702755]: 1.0 sec...
[ INFO] [1606142820.180460892]: 0 sec
TM_ROS: (TM_SCT) connect(1000)...
[ INFO] [1606142820.180621233]: TM_COM: ip:=192.168.x.105
[ INFO] [1606142821.198290859]: TM_COM: rv:=-1
[ WARN] [1606142822.199559454]: TM_COM: Connection timeout
[ INFO] [1606142822.199697054]: TM_COM: O_NONBLOCK connection is fail
[ INFO] [1606142822.199748554]: TM_ROS: (TM_SCT): is not connected
[ INFO] [1606142822.199797346]: TM_ROS: (TM_SCT) reconnect in 
[ INFO] [1606142822.199848506]: 3.0 sec...
[ INFO] [1606142823.413549785]: 2.0 sec...
[ INFO] [1606142824.625990305]: 1.0 sec...
[ INFO] [1606142825.838793145]: 0 sec
TM_ROS: (TM_SCT) connect(1000)...

Showing that the communication is not working as expected. It reports Connection timeout. But as explained before, when manually connecting to that port the information exists.

In String or Json mode

Furthermore, when changing the communication mode in TMFlow to either String or Json, the reported error changes to the next:

process[tm_driver-2]: started with pid [26497]
[ INFO] [1606147147.490524114]: TM_ROS: robot_ip:=192.168.x.105
[ INFO] [1606147147.490560455]: TmCommunication::TmCommunication
[ INFO] [1606147147.490589362]: TmCommunication::TmCommunication
[ INFO] [1606147147.493734787]: TM_ROS: set base_frame to base
[ INFO] [1606147147.494779417]: TM_ROS: set tool_frame to tool0
[ INFO] [1606147147.494797615]: TM_DRV: halt
[ INFO] [1606147147.494810074]: TM_DRV: start
[ INFO] [1606147147.494820180]: TM_SVR: start
[ INFO] [1606147147.494838319]: TM_COM: ip:=192.168.x.105
[ INFO] [1606147147.495186428]: TM_COM: rv:=0
[ INFO] [1606147147.495199780]: TM_COM: Connection is ok
[ INFO] [1606147147.495211233]: TM_COM: O_NONBLOCK connection is ok
[ INFO] [1606147147.495222191]: TM_COM: TM robot is connected. sockfd:=10
[ INFO] [1606147147.495248826]: $TMSVR,24,Play,2,Stick_PlayPause=1,*11

[ INFO] [1606147147.495271206]: TM_SCT: start
[ INFO] [1606147147.495287727]: TM_COM: ip:=192.168.x.105
[ INFO] [1606147152.718565215]: TM_COM: rv:=-1
[ WARN] [1606147157.723057396]: TM_COM: Connection timeout
[ INFO] [1606147157.723225256]: TM_COM: O_NONBLOCK connection is fail
[ INFO] [1606147157.744940721]: TM_ROS: publisher thread begin
[ INFO] [1606147157.745328478]: TM_ROS: (TM_SVR): (1): invalid mode (2)
[ INFO] [1606147157.745407084]: TM_ROS: (TM_SVR): (Play) (0) ModeError;Stick_PlayPause
[ INFO] [1606147157.745470186]: TM_ROS: (TM_SVR): (2): invalid mode (2)
[ INFO] [1606147157.745527441]: TM_ROS: (TM_SVR): (3): invalid mode (2)
[ INFO] [1606147157.745568797]: TM_ROS: (TM_SVR): (4): invalid mode (2)
[ INFO] [1606147157.745831903]: TM_ROS: (TM_SVR): (5): invalid mode (2)
[ INFO] [1606147157.745905418]: TM_ROS: (TM_SVR): (6): invalid mode (2)
[ INFO] [1606147157.745939923]: TM_ROS: (TM_SVR): (7): invalid mode (2)
[ INFO] [1606147157.745996956]: TM_ROS: (TM_SVR): (8): invalid mode (2)
[ INFO] [1606147157.746280322]: TM_ROS: (TM_SVR): (9): invalid mode (2)
[ INFO] [1606147157.746330858]: TM_ROS: (TM_SVR): (0): invalid mode (2)

Which indicates that the connection is established but not understood.

Any suggestions?

spd-intermodalics commented 3 years ago

I understand that what is missing in the read me is to mention that you need to actually run the suggested project, because the Listen block rises a server listening in port 5890.

So, effectively there are 2 connections: TM_SVR and TM_SCT. In my case, the former was successfully connected to 5981 but the latter failed to connect to 5890:

Is there any option to only launch the part related to report the status of the robot, without needing the Listener block? So that obtaining robot poses is independent from the program running and the console is not spammed with futile attempts to connect to 5980?

jvdtoorn commented 3 years ago

Hey @spd-intermodalics, I'm currently facing the same issue. However my TM_SVR is also giving errors. Is your Modbus working correctly? Because I get the error "Modbus initialize error" on bootup. Which ethernet port on the TMFlow machine did you use?

jrajaram20 commented 3 years ago

Hi @julespalles You need to use GigE port. During initial setup, I ignored the SVR connection timeout and tested the demo program. Its working fine.

jvdtoorn commented 3 years ago

Thanks for your response @jrajaram20. Yes, I managed to get both SVR and SCT working by using the GigE port!