Also, related to this topic: is there an easy function anywhere in the API to enumerate all available Astras? I'm working on Windows using .NET, so I'm somewhat restricted to what's available through the .NET wrapper.
What I'm doing right now is enumerating all of the USB devices and counting how many have VID=2bc5 and PID=040* to determine n, and then looping from 0 to n-1 and opening device/sensor{n}
This approach works, but it would be nice if there was a static function in the Astra.StreamSet class that returned an IEnumerable of all available stream sets. That way you could just go:
foreach(Astra.StreamSet s in Astra.StreamSet.GetAvailable())
{
// do whatever it is you need to do here
}
Add to that the ability to easily get a consistent, unique ID for each StreamSet and the ability to open a StreamSet based on such an ID and that would make developing applications that use multiple Astras far more reliable. e.g.:
// contains code for processing camera data and applying offsets/rotations so that
// the depth/colour stream from this camera can be lined up with other
// cameras, allowing us to seam multiple cameras to cover a larger area
class AstraCamera
{
...
private Astra.StreamSet Streams{ get; set;}
// a globally unique, hardware-specific ID that we can
// save to uniquely identify each Astra
[DataMember]
private string UniqueID {get; set;}
// when deserializing the saved configuration, re-open the Astra so
// that it can provide data
[OnDeserialized]
private void OnDeserialized(StreamingContext sc) {
Streams = Astra.StreamSet.Open(UniqueID);
...
}
// save the camera to an XML file we can deserialize later (e.g. next time we launch)
// the application
public void Save(string filename) {
UniqueID = Streams.HardwareID; // <-- this gives us the unique ID for each sensor
using(FileStream fs = new FileStream(filename, FileMode.Create)) {
DataContractSerializer xml = new DataContractSerializer(this.GetType());
xml.WriteObject(fs, this);
}
}
}// end of class