0
$\begingroup$

Rosanswers logo

Hello, guys.

I've been working on a project that needs data sent from an Arduino Nano, via bluetooth module (HC-05), to be received and used by a node on ROS. In order to do that, I've already developed the code for getting the message data from the bluetooth port and sending them to another node. I've been using the following steps to accomplish my goal.

Detect bluetooth devic $ rosrun imu imues.

$ hcitool scan

Pair device.

$ bluez-simple-agent hci0 20:15:07:27:76:81

Edit rfcomm.conf file with "bind no" configuration.

$ sudo vim /etc/bluetooth/rfcomm.conf

Initialize ROS.

$ roscore

Establish connection between bluetooth module and computer.

$ sudo rfcomm connect 0

Create linking between the bluetooth port (rfcomm0) and a random serial port to be created. This is done because if I set rfcomm0 port as a parameter of one of my nodes, apparently, the node doesn't recognize it and doesn't work.

$ sudo ln -s /dev/rfcomm0 /dev/ttyBluetooth

Set the recently created port (ttyBluetooth) as a parameter for one of my nodes.

$ rosparam set /imu_node/serial_port "/dev/ttyBluetooth"

Run node.

$ rosrun imu imu

The problem is that, when I do this, at first, it doesn't work and the node seems to crash (I can't stop it with Ctrl+C neither Ctrl+X). But, if I follow the steps below, it works normally.

  • Close the terminal session where the node was called.

  • Terminate bluetooth connection.

  • Terminate ros session.

  • Restart bluetooth connection.

    $ sudo rfcomm connect 0

  • Restart ROS.

    $ roscore

  • Reset the parameter.

    $ rosparam set /imu_node/serial_port "/dev/ttyBluetooth"

  • Run the node again.

    $ rosrun imu imu

Does anyone know what might be happening?

Thank you all.


Originally posted by Giovani Debiagi on ROS Answers with karma: 31 on 2016-10-08

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

SOLVED

Well, it seems like my bluetooth module (HC-05) gets "busy" when I try to connect it to the computer for the first time, since it's on. I've seen some tutorials where one of the last steps was "If you get a message telling you that your device is busy, try restarting the connection". This has made me assume that people often have this problem and it's hardware or even a bluetooth-ubuntu connection issue.


Originally posted by Giovani Debiagi with karma: 31 on 2016-10-14

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.