bluespace-ai / bluespace_ai_xsens_ros_mti_driver

xsens ros2 driver
BSD 3-Clause "New" or "Revised" License
47 stars 63 forks source link

Problem to launch (Ubuntu 22, ROS-2 Humble) #16

Closed waltejon closed 6 months ago

waltejon commented 1 year ago

Dear all,

I am facing a problem to launch the package.

As you see in the figure below,

Here are the specifications of my setup:

When I start the MT Manager, I have access to the IMU data.

This problem might me similar to https://github.com/bluespace-ai/bluespace_ai_xsens_ros_mti_driver/issues/13#issuecomment-1278023693.

grafik

Steven-GH commented 1 year ago

Hi @waltejon, Are you in the dialout group? You can check this by using the groups command.

I also recommend updating the param/xsens_mti_node.yaml file. Set _scan_fordevices to false and enter the port ("/dev/ttyUSB0"). Can you give that a try?

waltejon commented 1 year ago

@StevenXsens: Thank you for the answer! 😊

I followed you recommondations. However, the isse is still open. It seems like that the XSENS is still not found, although the driver is now searching directly at the port /dev/ttyUSB0 the XENS is connected to.

@StevenXsens: Do you have an idea what the problem is? Could a different baudrate be a problem?

grafik

dialout group

I used the groups command. According to the feedback, I would assume that I am in the dialout group.

grafik

YAML file

I also updated the YAML file you mentioned (see below).

    ros__parameters:

        ## Device settings, provide one of the following:
        ##  - scan_for devices = 
        ##          true:   the driver ignores port and baudrate settings, scans for devices on all ports and selects the first found
        ##          false: = Requires correct port and baudrate both to be specified
        scan_for_devices: false
        port: "/dev/ttyUSB0" # port name, e.g. '/dev/ttyUSB0'
        baudrate: 115200 # non necessary for some devices
waltejon commented 1 year ago

A different baudrate might be not the problem.

In addition to the comment above (https://github.com/bluespace-ai/bluespace_ai_xsens_ros_mti_driver/issues/16#issuecomment-1301783858), I checked different baudrates

For every of these baudrates, the launch stucked while "Scanning port /dev/ttyUSB0".

Steven-GH commented 1 year ago

Hi @waltejon,

If you plug in your MTi and then send dmesg from a terminal, does it say that your device has been attached to /dev/ttyUSB0? Also, are you using a direct USB cable or a USB cable with a black converter box along the cable?

pshved commented 1 year ago

Hi @waltejon we faced a similar problem at Bluespace; could you please try this fix and see if it works? https://github.com/bluespace-ai/bluespace_ai_xsens_ros_mti_driver/pull/17

Marcel2103 commented 1 year ago

Thank you, @pshved this fixes also for me the error with humble. The pull request should get accepted.

waltejon commented 1 year ago

@pshved: Thanks for the hint regarding your fix.

I changed the threading.cpp according to your commit. However, the XSENS is still not recognized (see Figure below).

grafik

waltejon commented 1 year ago

@StevenXsens:

When I send dmesg from a terminal (https://github.com/bluespace-ai/bluespace_ai_xsens_ros_mti_driver/issues/16#issuecomment-1302126487), I get the following feedback:

[  810.678399] usb 2-2.2: Product: MTi-300 AHRS
[  810.678427] usb 2-2.2: Manufacturer: Xsens
[  810.678428] usb 2-2.2: SerialNumber: ******B6
[  810.706366] usbcore: registered new interface driver usbserial_generic
[  810.706693] usbserial: USB Serial support registered for generic
[  810.708372] usbcore: registered new interface driver xsens_mt
[  810.708379] usbserial: USB Serial support registered for xsens_mt
[  810.708393] xsens_mt 2-2.2:1.1: xsens_mt converter detected
[  810.708888] usb 2-2.2: xsens_mt converter now attached to ttyUSB0

The XSENS MTi-300-2A5G4 is connected using a direct USB cable. There is no converter box along the cable.

waltejon commented 1 year ago

@StevenXsens, @pshved: I also need to say that my Ubuntu 22 machine is a virtual machine (VMware). However, I connected the XSENS to the Ubuntu machine and not my host machine (Windows 11). Since, the device is listed when I command lsusb and dmesg, I assumed that this connection might be valid, although a virtual machine is used.

Steven-GH commented 1 year ago

Hi @waltejon,

Have you rebuilt the xspublic library after making changes to threading.cpp? Best is to force this from the xspublic folder using make -B. After that, run colcon build again.

I have just tried running the driver with an MTi-300 connected over USB, on an Ubuntu 22.04 virtual machine (VirtualBox), and it was able to detect the device. I think I've used the same modifications as you have so far.

waltejon commented 1 year ago

@StevenXsens: In the first attempt, I did not command make -B from the xspublic folder, but I commanded colcon build. However, when I rebuild the library using make -B from that folder and afterwards colcon build, the device is still not found.

jw@wapiti:~/ros2_ws$ ros2 launch bluespace_ai_xsens_mti_driver xsens_mti_node.launch.py
[INFO] [launch]: All log files can be found below /home/jw/.ros/log/2022-11-09-15-05-56-582358-wapiti-8133
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [xsens_mti_node-1]: process started with pid [8134]
[xsens_mti_node-1] RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED is now ignored. Please set RCUTILS_LOGGING_USE_STDOUT and RCUTILS_LOGGING_BUFFERED_STREAM to control the stream and the buffering of log messages.
[xsens_mti_node-1] [INFO] [1668002756.702574283] [xsens_mti_node]: Creating XsControl object...
[xsens_mti_node-1] [INFO] [1668002756.710962182] [xsens_mti_node]: Found baudrate parameter: 115200
[xsens_mti_node-1] [INFO] [1668002756.711399212] [xsens_mti_node]: Found port name parameter: /dev/ttyUSB0
[xsens_mti_node-1] [INFO] [1668002756.711726116] [xsens_mti_node]: Scanning port /dev/ttyUSB0 ...
waltejon commented 1 year ago

@StevenXsens: I would have two questions if I may ask:

Steven-GH commented 1 year ago

Hi @waltejon,

I am also using the MTi-300-2A5G4, so that can't be the issue. You might want to check if your device is running the latest firmware version though (1.8.2). Additionally, clicking the Revert button in MT Manager might help. This will reset the factory defaults of your device.

I'm running ROS2 Humble and using the Foxy branch.

waltejon commented 1 year ago

@StevenXsens: Thank you for the tips I followed. However, this issue is still open.

jw@wapiti:~/ros2_ws$ ros2 launch bluespace_ai_xsens_mti_driver xsens_mti_node.launch.py
[INFO] [launch]: All log files can be found below /home/jw/.ros/log/2022-11-09-16-29-24-243753-wapiti-2933
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [xsens_mti_node-1]: process started with pid [2934]
[xsens_mti_node-1] RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED is now ignored. Please set RCUTILS_LOGGING_USE_STDOUT and RCUTILS_LOGGING_BUFFERED_STREAM to control the stream and the buffering of log messages.
[xsens_mti_node-1] [INFO] [1668007764.460467704] [xsens_mti_node]: Creating XsControl object...
[xsens_mti_node-1] [INFO] [1668007764.474280354] [xsens_mti_node]: Found baudrate parameter: 115200
[xsens_mti_node-1] [INFO] [1668007764.474801375] [xsens_mti_node]: Found port name parameter: /dev/ttyUSB0
[xsens_mti_node-1] [INFO] [1668007764.475062305] [xsens_mti_node]: Scanning port /dev/ttyUSB0 ...

I updated the firmare to the latest version (see Figure below). I also reverted the settings to the factory defaults by using the MT Manager.

grafik

Steven-GH commented 1 year ago

Hi @waltejon,

I am sorry but at this point I am a bit at loss about what else the problem can be, mostly because I cannot reproduce it on my side with a very similar setup. What you can still try is to run the C++ example code that is part of the MT Software Suite on your Ubuntu system. It uses the same xspublic library, so you would need to implement the same changes again in threading.cpp before building the code. But you can run it with sudo and it will exclude the ROS environment, which might give different results. Anyway, the example is called _example_mti_receivedata and is located at _[MTSDK folder]\examples\mtsdk\xda_publiccpp. See also: https://base.xsens.com/s/article/Introduction-to-the-MT-SDK-programming-examples-for-MTi-devices?language=en_US If you need help with this, please send us a message at support@xsens.com.

waltejon commented 1 year ago

Problem is now solved. I repeated all the steps again in a new workspace and now it works.

How the problem was solved?

@StevenXsens: Thank you very much for your help and all the tips! 😊

From my side, this issue could be closed.

erknl commented 6 months ago

Could you explain the solution in more detail?

pshved commented 6 months ago

So since PR #17 solves the problem, should we merge it into master?