Using Bluetooth(Bluez4.101) with cob_people_detection under ROS indigo

asked 2017-08-24 02:45:34 -0500

freshman J gravatar image

updated 2017-08-24 19:25:54 -0500

Want to ask a question about using Bluetooth(Bluez4.101) under ROS. Currently I’m using ROS Indigo under Ubuntu14.04. I’m using a ROS facial recognition package called cob_people_detection http://wiki.ros.org/cob_people_detection , and I want to use bluez to send the result of facial recognition to Raspberry Pi 3. I used a simple program from bluez tutorial http://people.csail.mit.edu/albert/bluez-intro/x502.html to send message:

<!-- language: c# -->

#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
int main(int argc, char **argv)
{
struct sockaddr_rc addr = { 0 };
int s, status;
char dest[18] = "43:43:A1:12:1F:AC";
//char dest[18] = "0C:51:01:2B:CA:8A";

// allocate a socket
s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);

// set the connection parameters (who to connect to)
addr.rc_family = AF_BLUETOOTH;
addr.rc_channel = (uint8_t) 1;
str2ba( dest, &addr.rc_bdaddr );

// connect to server
status = connect(s, (struct sockaddr *)&addr, sizeof(addr));

 // send a message
if( status == 0 ) {
   status = write(s, "hello!", 6);
}

//if( status < 0 ) perror("uh oh");
close(s);
//return 0;
}

And I ran command : “gcc -o rfcomm-client rfcomm-client.c –lbluetooth” I successfully send the message to raspberry pi 3. And I tried to put the Bluetooth code into the node: people_detection_display_node.cpp which is the node of cob_people_detection.

/*!
 *****************************************************************
 * \file
 *
 * \note
 * Copyright (c) 2012 \n
 * Fraunhofer Institute for Manufacturing Engineering
 * and Automation (IPA) \n\n
 *
 *****************************************************************
 *
 * \note
 * Project name: Care-O-bot
 * \note
 * ROS stack name: cob_people_perception
 * \note
 * ROS package name: cob_people_detection
 *
 * \author
 * Author: Richard Bormann
 * \author
 * Supervised by:
 *
 * \date Date of creation: 07.08.2012
 *
 * \brief
 * functions for display of people detections
 *
 *****************************************************************
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer. \n
 * - Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution. \n
 * - Neither the name of the Fraunhofer Institute for Manufacturing
 * Engineering and Automation (IPA) nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission. \n
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License LGPL as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License LGPL for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License LGPL along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 ****************************************************************/

#include <cob_people_detection/people_detection_display_node.h>
#include <vector>
#include <string>
#include <stdio.h ...
(more)
edit retag flag offensive close merge delete

Comments

Please copy and paste the errors that you're receiving (preferably towards the beginning of your question) instead of linking to a screenshot. http://wiki.ros.org/Support#Do

jayess gravatar imagejayess ( 2017-08-24 20:04:02 -0500 )edit