diff --git a/spinnaker_camera_driver/cfg/Spinnaker.cfg b/spinnaker_camera_driver/cfg/Spinnaker.cfg index ab976ec0..dacd6893 100755 --- a/spinnaker_camera_driver/cfg/Spinnaker.cfg +++ b/spinnaker_camera_driver/cfg/Spinnaker.cfg @@ -306,6 +306,11 @@ auto_lighting_mode = gen.enum([ ], "Auto algorithms lighting modes") gen.add("auto_exposure_lighting_mode", str_t, SensorLevels.RECONFIGURE_RUNNING, "Auto exposure lighting mode.", "Normal", edit_method=auto_lighting_mode) +# GigE camera parameters +gen.add("gige_parameter_enable", bool_t, SensorLevels.RECONFIGURE_STOP, "GigE camera parameters enabled", False) +gen.add("device_link_throughput_limit", int_t, SensorLevels.RECONFIGURE_RUNNING, "Device link throughput limit", 14353165, 0) +gen.add("camera_packet_size", int_t, SensorLevels.RECONFIGURE_STOP, "GigE camera packet size", 1400, 0) + # Other gen.add("time_offset", double_t, SensorLevels.RECONFIGURE_RUNNING, "Time offset to add to image time stamps.", 0.0, -5.0, 5.0) diff --git a/spinnaker_camera_driver/include/spinnaker_camera_driver/SpinnakerCamera.h b/spinnaker_camera_driver/include/spinnaker_camera_driver/SpinnakerCamera.h index 4cd9251b..51749f01 100644 --- a/spinnaker_camera_driver/include/spinnaker_camera_driver/SpinnakerCamera.h +++ b/spinnaker_camera_driver/include/spinnaker_camera_driver/SpinnakerCamera.h @@ -52,6 +52,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // Header generated by dynamic_reconfigure #include @@ -160,6 +161,36 @@ class SpinnakerCamera */ void setDesiredCamera(const uint32_t& id); + /*! + * \brief Used to set the IP of the camera you wish to connect to. + * + * Sets the desired IP. If this value is not set, the driver will try to automatically + * assign an IP address to the camera. + * This function should be called before connect(). + * \param ip IP for the camera. Should be something like 192.168.0.2. + */ + void setDesiredIP(const std::string& ip); + + /*! + * \brief Used to set the subnet mask of the network the camera is connected to. + * + * Sets the subnet mask. If this value is not set, the driver will assign the default subnet mask + * '255.255.255.0'. + * This function should be called before connect(). + * \param mask Subnet mask of the network. Should be something like 255.255.255.0. + */ + void setDesiredSubnetMask(const std::string& mask); + + /*! + * \brief Used to set the gateway of the subnet the camera will connect to. + * + * Sets the desired gateway. If this value is not set, the driver will automatically + * assign the gateway to the first address of the subnet. + * This function should be called before connect(). + * \param gateway Gateway address on the subnet. Should be something like 192.168.0.1. + */ + void setDesiredGateway(const std::string& gateway); + void setGain(const float& gain); int getHeightMax(); int getWidthMax(); @@ -171,8 +202,27 @@ class SpinnakerCamera return serial_; } +protected: + // Routine to find the desired camera to connect to. + void findCameraPtr(); + // Routine to update camera the desired camera's pointer after changing a camera parameter (e.g. IP address) + void updateCameraPtr(); + int64_t fromStrToIP(const std::string ip_str); + std::string convertIPtoStr(const int64_t ip_int); + + /*! + * \brief Used to apply the desired subnet configuration to the camera. + * + * This function sets the IP of the camera, the subnet mask and the gateway address for the network being used. + */ + void setIP(); + void tryAutoForceIP(); + private: uint32_t serial_; ///< A variable to hold the serial number of the desired camera. + int64_t ip_; ///< A variable to hold the IP to associate to the desired camera. + int64_t mask_; ///< A variable to hold the subnet mask of the network the desired camera is attached to. + int64_t gateway_; ///< A variable to hold the address of the gateway in the subnet the camera is connected to. Spinnaker::SystemPtr system_; Spinnaker::CameraList camList_; diff --git a/spinnaker_camera_driver/include/spinnaker_camera_driver/camera.h b/spinnaker_camera_driver/include/spinnaker_camera_driver/camera.h index 5454588d..efc73eb3 100644 --- a/spinnaker_camera_driver/include/spinnaker_camera_driver/camera.h +++ b/spinnaker_camera_driver/include/spinnaker_camera_driver/camera.h @@ -63,6 +63,7 @@ class Camera static const uint8_t LEVEL_RECONFIGURE_RUNNING = 0; virtual void setGain(const float& gain); + inline void setPacketSizeMax(const unsigned int size) { packet_size_max_ = size; }; int getHeightMax(); int getWidthMax(); @@ -78,6 +79,7 @@ class Camera int height_max_; int width_max_; + unsigned int packet_size_max_; /*! * \brief Changes the video mode of the connected camera. @@ -87,6 +89,8 @@ class Camera */ virtual void setFrameRate(const float frame_rate); virtual void setImageControlFormats(const spinnaker_camera_driver::SpinnakerConfig& config); + + void setGigEPacketSize(const int size); /*! * \brief Set parameters relative to GigE cameras. * diff --git a/spinnaker_camera_driver/launch/camera_gige.launch b/spinnaker_camera_driver/launch/camera_gige.launch new file mode 100644 index 00000000..703a81a2 --- /dev/null +++ b/spinnaker_camera_driver/launch/camera_gige.launch @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spinnaker_camera_driver/launch/stereo.launch b/spinnaker_camera_driver/launch/stereo.launch index ce0c2d7d..1bfa1da9 100644 --- a/spinnaker_camera_driver/launch/stereo.launch +++ b/spinnaker_camera_driver/launch/stereo.launch @@ -1,11 +1,9 @@