# A Heterogeneous Robotic Swarm for Long-Term Monitoring of Marine Environments
## 4 Agent Capabilities
### Docking and Energy Sharing  
Once an aMussel has completed a part of its monitoring mission, it surfaces and requests recharging from the aPads. A detailed description of mechanical modules and algorithms developed for the purpose of enabling energy sharing between two types of robotic agents, as well as an account of experimental procedures used to test the implemented system, is given in [22]. Autonomous docking is achieved by having the aPad search for and track the top cap of the aMussel using visual servoing and a rotating Kinect sensor looking down on the chosen unoccupied docking unit. The aMussel top cap has been covered in bright red IR reflective tape, enabling use of both RGB and infra-red capabilities of the Kinect sensor. This makes it possible for docking to occur in a wide variety of lighting conditions. The Kinect image processing algorithm first crops the image to a fixed \"horizon\" distance, in order to preserve a region of interest where the aMussel might actually be located, thus minimising the chances of false positive detections. Currently, the aPad is capable of observing objects within a radius of 4 m. The algorithm in RGB camera mode uses colour thresholding in the HSV colour space, after applying Contrast-limited Adaptive Histogram Equalization (CLAHE) to the cropped image in order to improve robustness of detection in varying conditions [23; 24]. In IR camera mode, greyscale thresholding is used. A comparison of a raw and a processed Kinect RGB camera image is given in Figure 19.  
Figure 18: Floating experiment aMussel inertial measurement unit (IMU) responses for \(x\), \(y\) and \(z\) component. A bounding box is placed around the largest cluster of pixels remaining in the image after thresholding. Visual servoing is accomplished by passing the coordinates of this bounding box to the controller, with the assumption that the origin of the coordinate system is in the centre of the image, both vertically and horizontally. Coordinates are scaled to a range of [\(-1\), 1] for aPad yaw and surge speed control purposes, with \(-1\) corresponding to the left edge and bottom of the image, and 1 being the right edge and top. A state machine representation of the high-level control of the aPad docking algorithm is given in Figure 20.  
The aPad docking control algorithm loop consists of three active phases:  
* **Search--**The aPad rotates at a set rate until it registers a camera frame containing the top cap of an aMussel. * **Approach--**The aPad moves towards the detected aMussel, turning in order to keep it centered in view and thus properly aligned with the mechanism for docking. Should the aMussel be lost from view during this phase, the aPad will recommence Search. * **Grasp--**The aPad closes the servo-actuated gripper on its docking mechanism once the reported position of the aMussel is close enough, i.e., below the set height threshold. Charging is started. Figure 19: Examples of the aPad Kinect RGB image, original (**left**) and processed (**right**). The green rectangle superimposed on the camera image represents a bounding box around the derived position of the aMussel top cap used to control the aPad’s approach. Figure 20: State machine representation of the aPad controller running the docking algorithm. The gripper on the docking mechanism is closed once the \(y\) coordinate of the located top cap falls below a certain vertical threshold, indicating that the mussel is close to the camera--and the docking point underneath it. This value has been calibrated with regards to the camera angle and the buoyancy and height of the fully surfaced aMussel in order to ensure a timely closing. The docking and charging setup was tested both in indoor testbeds as well as outside in real-world conditions. Charging status and current measured from both batteries present in the aMussel for the duration of one experiment are shown in Figure 21.  
Negative measured current signifies that the battery is receiving charge, making the start and end of charging easily visible in the resulting plots.