Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for selecting which camera to use #55

Merged
merged 3 commits into from Oct 22, 2018
Merged

Conversation

@rohbotics
Copy link
Member

@rohbotics rohbotics commented Oct 19, 2018

Related to #41

@realizator Can you see if this at least partially suits your needs?

@rohbotics rohbotics self-assigned this Oct 19, 2018
@rohbotics rohbotics requested a review from jim-v Oct 19, 2018
@ghost ghost added the in progress label Oct 19, 2018
@rohbotics rohbotics changed the title Add supporting to selecting which camera to use Add support for selecting which camera to use Oct 19, 2018
@realizator
Copy link

@realizator realizator commented Oct 19, 2018

@rohbotics, camera select option looks good. I will ask my friend with ROS experience if he will be able to use it.
upd> Friend says if he will be able to run two instances of a driver it should work. We a ready to test it if you'll be able to give us "night build" image with this feature implemented.

Also two notices for you. While working in stereo mode one camera is set as "master", another as "slave", or "secondary". "Master" makes auto settings, and secondary camera copies all settings form master (like brightness, AWB, contrast etc.) for images to be captured with the same settings. If we take independent images we can obtain different settings (especially in a case of light source on the left or right - settings will differ). But for the first stage tests it is not so critical.

Second notice for the future. If I work with stereo mode in Pi and make "-cs 1" - second camera became "master", and cameras are "swapped" in final image. That is left became right and vice versa. We should keep it in a mind for the future.

@rohbotics
Copy link
Member Author

@rohbotics rohbotics commented Oct 20, 2018

Here is a deb file to test off of: https://drive.google.com/open?id=1VhjHMQT-46AEUKsidiEA0s1utdU7aw_c

To install:
Download the file onto the pi
On the Pi: sudo apt install ./ros-kinetic-raspicam-node_0.3.0~pr55_armhf.deb

To test on our image:
roslaunch raspicam_node camerav2_1280x960_10fps.launch
then in another terminal rqt_image_view rqt_image_view /raspicam_node/image/compressed

Ctrl+C the processes
run rosparam set /raspicam_node/camera_id 1
then run roslaunch raspicam_node camerav2_1280x960_10fps.launch again
then the other terminal run rqt_image_view again

You should see images from different cameras each time.

Copy link

@jimvaughan jimvaughan left a comment

Looks reasonable

@jim-v
jim-v approved these changes Oct 20, 2018
Copy link
Contributor

@jim-v jim-v left a comment

Looks reasonable to me too :)

@rohbotics
Copy link
Member Author

@rohbotics rohbotics commented Oct 20, 2018

@realizator can you test this out and let me know if it lets you switch cameras?

@davecrawley
Copy link
Contributor

@davecrawley davecrawley commented Oct 21, 2018

@realizator
Copy link

@realizator realizator commented Oct 21, 2018

@rohbotics I will have access to my equipment tomorrow and can check camera selection. Will write you my results right after tests.

@realizator
Copy link

@realizator realizator commented Oct 22, 2018

@rohbotics I tested your DEB.

  1. While sudo apt install ./ros-kinetic-raspicam-node_0.3.0~pr55_armhf.deb I got "Could not get lock /var/lib/dpkg/lock" message. I solved this with sudo rm /var/lib/dpkg/lock and installed DEB successfully.

  2. In your suggested line rqt_image_view rqt_image_view /raspicam_node/image/compressed there are two copies of rqt_image_view. While run I got "error: unrecognized arguments...". I think this is typo and you just twice "pasted" this, thus I leave only one "rqt_image_view" in your command row. After that it started successfully.

  3. I succesfully got image from the first camera.

  4. After ctrl+c "rqt_image_view" process in a second terminal, setting camera ID to 1 does nothing. So I did:

  • stopped "roslaunch raspicam_node..." too
  • run rosparam set /raspicam_node/camera_id 1
  • run roslaunch raspicam_node camerav2_1280x960_10fps.launch
  • run rqt_image_view /raspicam_node/image/compressed
    and successfully got image from the second camera.

Just a mention - I have v1 camera (wide-angle clone of original V1), but all your commands for V2 works.

@realizator
Copy link

@realizator realizator commented Oct 22, 2018

p.s. sorry for posting 3 comments - GitHub have some problems now with login and posting comments ("You can't comment at this time."). I deleted duplicated comments.

@rohbotics
Copy link
Member Author

@rohbotics rohbotics commented Oct 22, 2018

Awesome! Merging.

Yup, my bad on the rqt_image_view command, sorry about that

Just FYI
sudo rm /var/lib/dpkg/lock is probably a bad idea, because that means some auto-update process is (annoyingly) running in the background. Will disable this on the next image.

@rohbotics rohbotics merged commit 51c4c5b into kinetic Oct 22, 2018
@rohbotics rohbotics deleted the camera-select branch Oct 22, 2018
@ghost ghost removed the in review label Oct 22, 2018
@realizator
Copy link

@realizator realizator commented Oct 23, 2018

upd> @rohbotics , also two notices about tests

  1. While run "rqt_image_view..." I got warning "libEGL warning: DRI2: failed to authenticate " every time, but it works.

  2. If I try to choose "/raspicam_node/image" or "raspicam_node/image/raw" I have grayscale gradient static image, no real picture. If I choose raspicam_node/image/compressed in QT dropdown list I got normal image. I also try to add _image_transport:=raw according to warning from [image_transport] but it does not fix it. Where am I do something wrong?

@rohbotics
Copy link
Member Author

@rohbotics rohbotics commented Oct 23, 2018

libEGL warning: DRI2: failed to authenticate - Normal on the Raspberry Pi

Do you have raw publishing enabled?
rosparam set /raspicam_node/enable_raw true and then start raspicam.

@realizator
Copy link

@realizator realizator commented Oct 25, 2018

@rohbotics I tested it with enable_raw, and looks like it works.
As for libEGL warning - ok, now I know.

@amburkoff
Copy link

@amburkoff amburkoff commented Oct 26, 2018

@rohbotics How to simultaneously run two nodes so that one streams the left camera and the other right in different topics?

@karlahaiat
Copy link

@karlahaiat karlahaiat commented Jul 9, 2019

@rohbotics How to simultaneously run two nodes so that one streams the left camera and the other right in different topics?

I am also interested in this, is it possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants