OS: Ubuntu 12.04
ROS: Fuerte
Camera: Bumblebee2 -> svn co `cu-ros-pkg.googlecode.com/svn/trunk/bumblebee2`
Other Software include: Bumblebee2 ROS package, libdc1394-22, Coriander programme.
Other links cheked:
http://answers.ros.org/question/11492/bumblebee2-or-bumblebee1394-this-is-the-question
http://answers.ros.org/questions/37289/revisions/
http://answers.ros.org/question/33666/error-with-rosmake-bumblebee2-fuerte
http://ninghang.blogspot.com.es/2011/11/running-bumblebee2-on-ros-tutorial.html
And I can't run bumblebee2 in fuerte. I follow 2 lines: one with the updated package camera1394 like this:
<launch>
<!-- name node (and topic) after parameter file -->
<node pkg="camera1394" type="camera1394_node"
name="bumblebee2" output="screen">
<rosparam
file="$(find DemoROS)/launch/bumblebee2.yaml" />
</node>
</launch>
and the yaml
# Sample camera parameters for the Bumblebee2
#guid: 08144361026320a0 (defaults to first camera found)
#video_mode: 1024x768_mono #for a single grayscale frame
video_mode: 1024x768_mono16 #for bumblebee2
fps: 15
bayer_pattern: GRBG
bayer_method: Nearest
settings_url: file:///opt/ros/camera_settings/bumblebee_right.yaml
settings_url2: file:///opt/ros/camera_settings/bumblebee_left.yaml
# these all default to automatic settings:
#brightness: 511
#exposure: 256
#gain: 150
shutter: -1
#whitebalance: "2000 2000"
$ roslaunch DemoROS bumblebee2_lsi.launch
[ INFO] [1360084095.413930703]: Found camera with GUID b09d010090cf10
[ INFO] [1360084095.414026074]: No guid specified, using first camera found, GUID: b09d010090cf10
[ INFO] [1360084095.414056375]: camera model: Point Grey Research Bumblebee2 BB2-08S2C
[ WARN] [1360084095.414878719]: [Nearest] Bayer decoding in the driver is DEPRECATED; image_proc decoding preferred.
[ERROR] [1360084095.414906986]: Unknown Bayer method [Nearest]. Using ROS image_proc instead.
[ERROR] [1360084095.415115555]: unknown bayer pattern [GRBG]
[ INFO] [1360084095.418217826]: [00b09d010090cf10] opened: 1024x768_mono16, 15 fps, 400 Mb/s
This way publish one image http://img707.imageshack.us/img707/4431/1024x768mono16.jpg with both camera data mixed. I try de-interlaced it but I don't know what I am doing wrong. I try with other formats like Format7_mode3 with dynamic_reconfigure pkg and this is the result: image http://img706.imageshack.us/img706/4717/format7mode3.jpg
My bumblebee2_lsi program is this:
#include <signal.h>
#include <ros/ros.h>
#include <ros/console.h>
#include <boost/format.hpp>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/image_encodings.h>
#include <tf/transform_listener.h>
//#include <camera_info_manager/camera_info.h>
#include <camera_info_manager/camera_info_manager.h>
#include <image_transport/image_transport.h>
#include <dynamic_reconfigure/server.h>
#include <dynamic_reconfigure/SensorLevels.h>
//#include "bumblebee2.h"
//#include "bumblebee2/Bumblebee2Config.h"
namespace enc = sensor_msgs::image_encodings;
/** @file
@brief camera1394 is a ROS driver for 1394 Firewire digital cameras.
This is a ROS port of the Player driver for 1394 cameras, using
libdc1394. It provides a reliable driver with minimal dependencies,
intended to fill a role in the ROS image pipeline similar to the other
ROS camera drivers.
The ROS image pipeline provides Bayer filtering at a higher level (in
image_proc). In some cases it is useful to run the driver without the
entire image pipeline, so libdc1394 Bayer decoding is also provided.
@par Advertises
- \b camera/image_raw topic (sensor_msgs/Image) raw 2D camera images
(only raw if \b bayer_method is \b NONE).
- \b camera/camera_info topic (sensor_msgs/CameraInfo) Calibration
information for each image.
@par Subscribes
- None
@par Parameters
- \b frame_id : @b [string] camera frame of reference
(Default: device node name)
- \b guid : @b [string] The guid of the camera (Default: "NONE")
- \b fps : @b [real] Frames per second (Default: 15.0)
- \b iso_speed : @b [int] ISO transfer speed (Default: 400)
- \b video_mode : @b [string] Desired image resolution and type (Default "800x600_mono"). The driver supports the following values:
"320x240_yuv422"
"640x480_mono"
"640x480_yuv422"
"640x480_rgb"
"800x600_mono"
"800x600_yuv422"
"1024x768_mono"
"1024x768_yuv422"
"1280x960_mono"
"1280x960_yuv422"
- \b bayer_pattern : @b [string] The pattern of the Bayer filter to use (Default: "NONE"). The driver supports the following values:
"BGGR"
"GRBG"
"RGGB"
"GBRG"
"NONE"
- \b bayer_method : @b [string] The type of Bayer processing to perform (Default: "NONE"). The driver supports the following values:
"NONE"
"DownSample" (1/2 size image)
"Nearest"
"Bilinear"
"HQ"
"VNG"
"AHD"
- \b exposure : @b [int] Sets the camera exposure feature to value.
- \b shutter : @b [int] Sets the camera shutter feature to value. -1 turns on auto shutter.
- \b whitebalance : @b [string] (e.g. "2000 2000") Sets the Blue/U and Red/V components of white balance. "auto" turns on auto white balance.
- \b gain : @b [int] Sets the camera gain feature to value. -1 turns on auto gain.
- \b brightness : @b [int] Sets the camera brightness feature to value.
@todo Make array of supported image encoding values, check parameter
settings against that. Make enum type for dynamic reconfiguration.
*/
class Bumblebee2lsi
{
private:
ros::NodeHandle privNH_; // private node handle
image_transport::ImageTransport *it_;
std::string camera_name_;
std::string frame_id_;
sensor_msgs::Image image_;
sensor_msgs::Image left_image_;
sensor_msgs::Image right_image_;
sensor_msgs::CameraInfo left_cam_info_;
sensor_msgs::CameraInfo right_cam_info_;
sensor_msgs::CameraInfo cinfo_;
/** image transport publish interface */
image_transport::CameraPublisher left_image_pub_;
image_transport::CameraPublisher right_image_pub_;
bool start_;
public:
Bumblebee2lsi() {
privNH_ = ros::NodeHandle("~");
it_ = new image_transport::ImageTransport(privNH_);
left_image_pub_ = it_->advertiseCamera("left/image_raw", 1);
right_image_pub_ = it_->advertiseCamera("right/image_raw", 2);
start_ = false;
}
~Bumblebee2lsi()
{
delete it_;
}
/** Update the bumblebee2 calibration data */
/** Author : Soonhac Hong ([email protected]) */
/** Date : 5/24/2010 */
/** Note : Calibration data is needed to show disparity image using image_view with stereo_view.*/
void updateBumblebee2CalibrationData()
{
double left_D_data[] = {-0.29496962080028677, 0.12120859315219049, -0.0019941265153862824, 0.0012058185627261283, 0.0};
double left_K_data[] = {543.60636929659358, 0.0, 321.7411723319629, 0.0, 543.25622524820562, 268.04452669345528, 0.0, 0.0, 1.0};
double left_R_data[] = {0.99980275533925467, -0.018533834763323875, -0.0071377436911170388, 0.018542709766871161, 0.99982737377597841, 0.0011792212393866724, 0.0071146560377753926, -0.0013113417539480422, 0.9999738306837177};
double left_P_data[] = {514.20203529502226, 0.0, 334.37528610229492, 0.0, 0.0, 514.20203529502226, 268.46113204956055, 0.0, 0.0, 0.0, 1.0, 0.0};
double right_D_data[] = {-0.2893208200535437, 0.11215776927066376, -0.0003854904042866552, 0.00081197271575971614, 0.0};
double right_K_data[] = {541.66040340873735, 0.0, 331.73470962829737, 0.0, 541.60313005445187, 265.72960150703699, 0.0, 0.0, 1.0};
double right_R_data[] = {0.99986888001551244, -0.012830354497672055, -0.0098795131453283894, 0.012818040762902759, 0.99991698911455085, -0.001308705884349387, 0.0098954841986237611, 0.001181898284639702, 0.99995034002140304};
double right_P_data[] = {514.20203529502226, 0.0, 334.37528610229492, -232.44101555000066, 0.0, 514.20203529502226, 268.46113204956055, 0.0, 0.0, 0.0, 1.0, 0.0};
left_cam_info_.D.resize(5);
right_cam_info_.D.resize(5);
memcpy(&left_cam_info_.D[0], &left_D_data[0], sizeof(left_D_data));
memcpy(&left_cam_info_.K[0], &left_K_data[0], sizeof(left_K_data));
memcpy(&left_cam_info_.R[0], &left_R_data[0], sizeof(left_R_data));
memcpy(&left_cam_info_.P[0], &left_P_data[0], sizeof(left_P_data));
memcpy(&right_cam_info_.D[0], &right_D_data[0], sizeof(right_D_data));
memcpy(&right_cam_info_.K[0], &right_K_data[0], sizeof(right_K_data));
memcpy(&right_cam_info_.R[0], &right_R_data[0], sizeof(right_R_data));
memcpy(&right_cam_info_.P[0], &right_P_data[0], sizeof(right_P_data));
}
void updateDataCallbackImage(const sensor_msgs::Image msg)
{
image_ = msg;
// get current CameraInfo data from topic /camera/image_info
left_cam_info_ = right_cam_info_= cinfo_;
left_image_.header.frame_id = right_image_.header.frame_id = image_.header.frame_id = left_cam_info_.header.frame_id = right_cam_info_.header.frame_id = image_.header.frame_id;
//update bumblebee2 calibration data
updateBumblebee2CalibrationData();
// Read data from the image_ via topic
if(start_){
left_cam_info_.header.stamp = right_cam_info_.header.stamp = left_image_.header.stamp = right_image_.header.stamp=image_.header.stamp;
left_cam_info_.height = right_cam_info_.height = left_image_.height = right_image_.height=image_.height;
left_cam_info_.width = right_cam_info_.width = left_image_.width = right_image_.width=image_.width;
left_image_.encoding = right_image_.encoding = image_.encoding;
//Split image into left image and right image
left_image_.step = right_image_.step = image_.step;
int image_size = image_.height*image_.step;
left_image_.data.resize(image_size);
right_image_.data.resize(image_size);
memcpy(&right_image_.data[0], &image_.data[0], image_size); // the image of right camera is the first half of the deinterlaced image.
memcpy(&left_image_.data[0], &image_.data[image_size], image_size); // the image of left camera is the second half of the deinterlaced image.
// Publish it via image_transport
left_image_pub_.publish(left_image_, left_cam_info_);
right_image_pub_.publish(right_image_, right_cam_info_);
}
}
void updateDataCallbackInfo(const sensor_msgs::CameraInfo info)
{
cinfo_ = info;
start_ = true;
}
}; // end Bumblebee2lsi class definition
/** Main entry point */
int main(int argc, char **argv)
{
ros::init(argc, argv, "bumblebee2_lsi");
ros::NodeHandle node;
Bumblebee2lsi bumblebee2;
ros::Subscriber sub_image = node.subscribe("camera/image_raw", 1000, &Bumblebee2lsi::updateDataCallbackImage, &bumblebee2);
ros::Subscriber sub_info = node.subscribe("camera/camera_info", 1000, &Bumblebee2lsi::updateDataCallbackInfo, &bumblebee2);
while (node.ok())
{
ros::spinOnce();
}
return 0;
}
It is a copy paste from http://cu-ros-pkg.googlecode.com/svn/trunk/bumblebee2/
and modify a little.
the results are the same image in both topics (right and left). I don't know why.
The other line to follow is using the code from http://cu-ros-pkg.googlecode.com/svn/trunk/bumblebee2
and try to compile. I follow that http://answers.ros.org/question/33666/error-with-rosmake-bumblebee2-fuerte
and I can compile all package and solve the segmentation fault but no images is published (the topics don't start to publish nothing).
What I am doing wrong? I hope somebody can help me. Thanks a lot
Originally posted by pmarinplaza on ROS Answers with karma: 330 on 2013-02-05
Post score: 0
Original comments
Comment by joq on 2013-02-05:
These questions come up often enough that I wish we could support an "official" ROS bumblebee driver. It's not all that different from the basic camera1394 driver, which I do support. Unfortunately, I have no bumblebee hardware for testing, so I cannot do that myself.
Comment by pmarinplaza on 2013-02-06:
Thanks for the comment ;) Maybe this code help a little to understand the problem: http://cu-ros-pkg.googlecode.com/svn/trunk/bumblebee2/src/dev_camera1394.cpp
(line 725) and the use of this code here : http://cu-ros-pkg.googlecode.com/svn/trunk/bumblebee2/src/bumblebee2.cpp
(line 382)