-
Notifications
You must be signed in to change notification settings - Fork 142
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
Adding PTP and sync free run #34
Comments
Hi Peter, |
2 reasons: 2nd reason is that the cameras will be in motion, and we know our position over time. Having good timestamps for when exposure starts/stops is then useful |
Hi Peter, no doubt PTP is very helpful & useful feature for synchronizing and triggering of multiple cameras and it is fully supported by the Basler pylon Camera Software Suite (but the ROS driver yet). |
I have a PC connected to a switch, connected to 2 cameras. These 2 cameras are used for stereo 3d reconstruction. We move the cameras around via a robot to fully scan a scene. Thus we want good syncing between cameras to be able to get good depth data while in motion, and having a synced clock means we get better position information based on robot's location. |
Hi & many thanks for revealing more information on the use case. |
@petercheng00 Hi Peter, we have little luck in grabbing the images from multiple cameras simultaneously. In our case, all the cameras are synchronized by ptp4l using the system as the master. By fetching the OffsetFromMaster value, we found multiple cameras seemed to be synchronized (the largest offset is -27 ticks). However, when we tried to retrieve the images the timestamps chunk data suggested there are about 0.1 seconds (1e8 ticks) difference between two images. Would you please provide some suggestions? Thanks! Our grabbing code is similar to this one: https://github.com/MattsProjects/PylonSample_Stereo_Acquisition_PTP/blob/master/source/PylonSample_Stereo_Acquisition_PTP.cpp |
Hi @johnzjq. I haven't seen that issue in my setup - my image timestamps are all only a couple nanoseconds apart. I am reading timestamps via a CGrabResultPtr from the OnImageGrabbed method of a CImageEventHandler. I notice your link uses timestamps passed via chunk data though. I'm not sure when chunk timestamps are taken, so perhaps that's one thing to check. |
Hi @petercheng00 , thanks for the reply! The problem has been solved by restarting the computer... The timestamp in the chunk data is given by the camera https://docs.baslerweb.com/data-chunks#timestamp-chunk. And we read the chunk data in the image grabbing loop. |
Hello Peter, I was taking a look to your branch https://github.com/iron-ox/pylon-ros-camera/tree/petercheng/ptp_sync_free_run Cheers, |
I am not actually using that code anymore - I wasn't that happy with how messy some of the integration was, so I decided to write a separate minimal ROS node specifically for PTP for my current application. |
My application has a great demand for PTP synchronization, and noticed that there is an implementation of PTP under your fork. And I have some questions about this. How can I get the timestamp after synchronization? Thanks, |
@chentairan I'm no longer using that fork - I've switched to a minimal stand-alone node instead, perhaps it will be useful to you: https://github.com/iron-ox/basler_camera/blob/iron-kinetic-devel/src/basler_synced_cameras_node.cpp As I mentioned above though, I do want to return to using this library, and I think the better way to include PTP would be to just expose the relevant pylon api calls, and let users externally handle syncing, capture strategy, etc. I hope to make a PR for that soon, it should be pretty simple. |
@m-binev Is there any plan to add support for this? After 2 years of struggling with PTP problems, we are thinking if we should change the cameras in our robots... In one of our applications, there are 4 Basler cameras that are "fighting" against our PTP master to become masters themselves. With other sensors, we just set the sensor to be on slave-only mode, and everything works as expected with no complications. Is there any way I could help implement this feature? |
@nachovizzo Hi, thank's for your message. And I beg a pardon, I've never been aware of your problems with PTP. Looking at the current issue, I think other users get PTP working fine already. Regarding the slave-mode, you can configure the cameras as slaves either. Please check the Basler documentation on: https://docs.baslerweb.com/precision-time-protocol |
Hi @m-binev , we encountered the same problem when using the camera, especially when the cameras were on a LAN formed by a switch. Once the last time the camera was the master clock, the camera will always be the master clock thereafter. Our solution is to have the PTP master clock connected directly to the camera to "reset"(I guess) the state of the camera clock. |
@chentairan , @nachovizzo Hi, to be honest I am not sure if we speak about right/wrong camera configuration or a camera issue. As it would be difficult to figure this out here (no proper equipment to do so), I would recommend you to open a standard support case (support.europe@baslerweb.com) while providing the Linux OS version, camera models/serial numbers, pylon version, setup description. I would not mention ROS yet, because you need a clarification on the camera configuration and behaviour first. According to the documentation though, you should be able to configure the cameras to accept an external master clock. Regards |
@m-binev We already contacted support many times. I thought of reaching out here to the community to see if someone had an alternative (not official) solution. Since it looks like BASLER is not interested in fully supporting the IEEE1558(PTP) protocol... According to this thread @petercheng00 also struggled with the same and we found a similar solution to the one we have right now... just wait until the cameras give up con fighting to be the master, as you might expect, is not acceptable :) If we find an alternative solution we will post it here for the benefit of the community, but so far looks like we won't be able to do it/ |
@nachovizzo Hi, may you name the support case number after having contacted the Basler support, please? I've just checked the support data base and found no support cases associated to you. Alternatively, please simply create a new support case and I'll make sure to give it some attention. Just pretending the cameras are not fully supporting PTP is not okay... Regards |
@m-binev Apologize for the trouble, I will ask the person on my team who has been following this on the Basler side, and ask for the support case. As far as I remember we got redirected to Rauscher that might explain why you can't find information on your system. Thanks for taking care of this issue |
Hello The ROS2 pylon driver v1.1.0 (branch galactic) gives now access through services to PTP related parameters and commands, allowing to enable PTP synchronization, to issue scheduled or not action commands, to use the periodic signal camera feature for ACE2 and the synchronous free-run feature for ACE1. |
I am using two Basler cameras as a stereo system for a car. The hardware synchronization is necessary for me. How can I do that with the ros package? |
I wanted to support PTP (#25 might be interested) and also synchronous free run. I have it working here: https://github.com/iron-ox/pylon-ros-camera/tree/petercheng/ptp_sync_free_run
However, the changes are somewhat messy. Sync free run require continuous capture mode and not software trigger mode, and the codebase seems to be built assuming software trigger mode. Do you have any suggestions for how the code could be made cleaner?
I was also considering making it a separate node for continuous capture / sync free run. Perhaps one node could manage multiple cameras to ensure they are all synced simultaneously. However, I couldn't find a good place to split between the node code and the camera code. Any thoughts or suggestions on that?
Thanks
The text was updated successfully, but these errors were encountered: