gestom / CosPhi

Artificial pheromone system
31 stars 14 forks source link

change the sourse of the camera feed to simulation #9

Open gemad opened 8 years ago

gemad commented 8 years ago

hey , I need to change the camera source in order to get it from simulator (gazebo) camera , any suggestions ? am thinking about creating a node to subscribe to the camera topic and change it into some thing which simulate the usb camera @gestom

gemad commented 8 years ago

after further reading i found out that i need to add a new camera type to the file ccamera.cpp which will be the gazebo camera , or converting the gazebo camera frames to image and use the camera type file (use sequence of images as input) please give me some guidelines as soon as possible @gestom

gemad commented 8 years ago

now am able to parse still images with type of bmp in a folder called videofile and sequence 00000001.bmp ++ to the localization , am trying to implement node to listen to the camera topic and save frames to this folder

gestom commented 8 years ago

IMHO the best way to get the feed from gazebo is to use socket-based communication. I should have a implementation of that somewhere, so if your node sends data over TCP instead of saving them, I can create a 'camera' that will simply listen on a given port for incoming data.

However, I think that the time has come for full ROS integration. I will try to modify the makefiles so that one could some something like 'make ros' and the camera and output will be ROS compatible.

gestom commented 8 years ago

The first option is possible within a few hours. The second might take more time, since I have not a sufficient experience in writing such stuff. So let me know what you think.

gemad commented 8 years ago

i found out a way to do that but still have problems with the set-up , there is a kernal module called v4l2loopback which create a fake camera device , and there is a ROS package called virtual_camera http://wiki.ros.org/virtual_camera which work together to make the ros based camera to be viewed as a connect video device under the /dev/videoX , what do you think about this solution? , i am still getting errors while installing the v4l2loopback so i didn't test that yet

if you will go with the porting for ros , i will be happy to help you , and we can talk about how i can help you

gestom commented 8 years ago

Let me test the sockets first if you don't mind to use a C++ code. But not before tomorrow, I am just about to board a flight and use another crappy hotel WiFi.

gemad commented 8 years ago

okay ,happy flight , and i will keep trying to get the virtual camera work till that

gestom commented 8 years ago

OK, so there is a 'ros' branch now, where the camera can read ros image topics. Enabling / disabling ros is simply a matter of (un)commenting a few lines in the src/Makefile. There are a few TODOS though: 1) Camera renewImage method should wait for a new image to arrive through the ros topic (we probably need to use semaphores). 2) Image should be resized and reformatted automatically - right now, we can process only one format and a specific size