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