Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Running NetFT node
Description: Tutorial describing how to configure Linux network to communicate with NetFT sensor. It also describes running NetFT ROS node and provides some troubleshooting tips.Tutorial Level: INTERMEDIATE
Contents
Introduction
netft_node is ROS node that communicates with NetFT and publishes force and torque data as ROS topic. This tutorial describes setting up Linux network to communicate with NetFT, and running netft_node
IP/Network Setup
The default jumper settings on the NetFT device cause it to come up with static IP address of 192.168.1.1 . The best way to communicate with device is to connect it to stand-alone Ethernet interface on a Linux box an configure interface with static IP in same network (such as 192.168.1.100).
Determine what network interface NetFT is connected to
In Linux there multiple ways to determine what network interface device is connected to.
Use kernel messages (dmesg)
- Power NetFT device and connect it to computer network interface.
Use dmesg to view recent kernel messages and determine which Ethernet interface most recently got link.
dmesg
Look at most recent logs messages for something like:eth2: link up, 100Mbps, full-duplex, lpa 0x41E1
In the above example, the kernel log indicates link just came up on eth2. If you just connected NetFT device, then eth2 is most likely connected to NetFT.
Brute force
The above method assumes that network interface that the NetFT is plugged into is already UP. If the network interface is not enabled (UP) automatically by Linux, then you might need to enable it manually. List all enabled (UP) devices by running:
ifconfig
On my computer I see a list like
ecat0 Link encap:Ethernet HWaddr 00:30:48:fd:84:e1 inet6 addr: fe80::230:48ff:fefd:84e1/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:220816400 errors:12 dropped:0 overruns:0 frame:12 TX packets:221150111 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:15599595555 (15.5 GB) TX bytes:15619846416 (15.6 GB) Memory:fbde0000-fbe00000 eth0 Link encap:Ethernet HWaddr 00:30:48:fd:84:e0 inet addr:10.0.2.150 Bcast:10.0.7.255 Mask:255.255.248.0 inet6 addr: fe80::230:48ff:fefd:84e0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:90285925 errors:2 dropped:0 overruns:0 frame:2 TX packets:57745152 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:36579140546 (36.5 GB) TX bytes:37421625997 (37.4 GB) Memory:fbce0000-fbd00000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:66142091 errors:0 dropped:0 overruns:0 frame:0 TX packets:66142091 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
NOTE: The lo interface is the loopback device. It is a virtual interface that you should ignore.
To see all Ethernet interface (enabled or not) run :
ifconfig -a
On my computer I see two more devices eth1 and eth2 that is not enabled:
ecat0 Link encap:Ethernet HWaddr 00:30:48:fd:84:e1 inet6 addr: fe80::230:48ff:fefd:84e1/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:220836957 errors:12 dropped:0 overruns:0 frame:12 TX packets:221170667 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:15601233701 (15.6 GB) TX bytes:15621484482 (15.6 GB) Memory:fbde0000-fbe00000 eth0 Link encap:Ethernet HWaddr 00:30:48:fd:84:e0 inet addr:10.0.2.150 Bcast:10.0.7.255 Mask:255.255.248.0 inet6 addr: fe80::230:48ff:fefd:84e0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:90297932 errors:2 dropped:0 overruns:0 frame:2 TX packets:57758199 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:36583529409 (36.5 GB) TX bytes:37430390886 (37.4 GB) Memory:fbce0000-fbd00000 eth1 Link encap:Ethernet HWaddr 00:50:5b:04:8a:b8 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) eth2 Link encap:Ethernet HWaddr 00:50:b6:03:f4:65 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:69593329 errors:0 dropped:0 overruns:0 frame:0 TX packets:74462 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4458104457 (4.4 GB) TX bytes:9184466 (9.1 MB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:66148458 errors:0 dropped:0 overruns:0 frame:0 TX packets:66148458 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:15412463465 (15.4 GB) TX bytes:15412463465 (15.4 GB)
You can try enabling Ethernet interface ethX by running:
sudo ifconfig ethX up
Setting IP address
Say you've determined that ethX is the Ethernet interface that the NetFT is connected to. If NetFT is configured with default IP address you should be able to communicate with it by running:
sudo ifconfig ethX 192.168.1.100
Verify connectivity with device by running
ping 192.168.1.1
If above command works, you should be able to view webpage from webserver running on NetFT by typing http://192.168.1.1 into web browser's address bar.
IP address on PR2
192.168.1.1 is the default address the NetFT box is configured with once shipped. Jumper 9 (inside NetFT box) even allows forces NetFT sensor to use IP address of 192.168.1.1. However on the PR2, the NetFT should be configured with static IP of 10.68.0.XXX where XXX is 60 if there are not conflicts with other devices. If NetFT is connected to PR2 network configure with Static IP of 10.68.0.XXX, the PR2 interface on PR2 will already be configured with the correct IP address.
Getting netft stack
The netft stack is not yet released as Debian package to unstable. The easiest ways to get netft debian package for unstable.
sudo apt-get install ros-unstable-netft
Running NetFT node
If can view NetFT's webpage with address such as 192.168.1.1 you should be able to run ROS node by running netft_node with same address.
rosrun netft_rdt_driver netft_node 192.168.1.1
Tf NetFT is on PR2 it is probably configured with static IP address of 10.68.0.60
rosrun netft_rdt_driver netft_node 10.68.0.60
Using rostopic to view netft node output
If the node doesn't quit immediately with an error message, then it should be running. You view ROS messages from device by running
rostopic echo netft_data
You should see messages like:
linear: x: -3.557435 y: -7.174037 z: 1.141398 angular: x: -0.113916 y: 0.117017 z: 0.010742 ---
Ploting netft_node force/torque outputs
It is also possible to plot data. An easy way to do this is use plot.sh script.
rosrun netft_rdt_driver plot.sh
You should see a window that has two graphs.
- A graph with X,Y, and Z force values
- A graph with X,Y, and Z torque values
Changing publishing rate
In next release of ROS the publishing rate can be changed from hardcoded default of 100Hz with with the --rate argument.
rosrun netft_rdt_driver netft_node 10.68.0.60 --rate 200
Publishing geometry_msgs::Wrench instead of geometry_msg::WrenchStamped
In next release of ROS the geometry_msg::Wrench message type will be replaced by geometry_msg::WrenchStamped. If you still want to publish Wrench data type, then use --wrench command line option.
rosrun netft_rdt_driver netft_node 10.68.0.60 --wrench
Troubleshooting
Problem : netft_node exits with error code on startup
Try accessing NetFT box from webpage using same address from webpage. If webpage doesn't work, netft_node will not work. Sometime Linux will try reconfiguring network interface when link is unplugged an then replugged. Try configuring IP address of network interface again with:
ifconfig ethX xxx.xxx.xxx.xxx
Where ethX is network interface NetFT box is plugged into, and xxx.xxx.xxx.xxx is IP address on same sub-network as NetFT box.
Problem : NetFT stops publishing data
View diagnostics coming from NetFT driver. Runtime monitor is good way to view diagnostics
rosrun runtime_monitor monitor