Package: rovlib
ROV LibraryA custom library developed byRobEnthat exactly fits our needs, be it programmatically controlling a Remote Operated Vehicle (ROV) or processing image data from the on-board cameras, it's got you covered.Table of contents 🗒InstallationUsageCamerasControlDependencyUser sideROV sideFuture PlansAuthorsInstalling ⬇The module is available at pypi, download with a simple$pipinstallrovlibGeneral Usage 🔑Like any other 3rd party module you can easily import the desiredsub-moduleby specifying what you want from the main rovlib modulefromrovlib.camerasimportRovCam# orfromrovlib.controlimportRovMavlink,JoyStickControlMore aboutrovlib.cameras? ➡Cameras moduleMore aboutrovlib.control? ➡Control moduleROV-cameras 🎥The camera module is required to receive OpenCV frames from ROV cameras being sent by theOn board camera systemused in conjunction with this user level module.How to use it 🔧Starting a camera 🟢To start capturing frames from a specific camera you have to start an instance of RovCam similarly as starting a cv2.VideoCapture() instance from opencv.As it might seem the interface is very similar toOpenCV's as the image data is originally captured on the ROV with OpenCV so it is required to run the script.fromrovlib.camerasimportRovCamimportcv2cam=RovCam(RovCam.FRONT)whileTrue:image=cam.read()cv2.imshow("ROV",image)ifcv2.waitKey(1)&0xFF==ord('q'):breakcv2.destroyAllWindows()The RovCam instance requires the user to specify which camera to get image data from, only asupported camerawould workCamera Options 📸As for now the camera option are:Front main camera looking aheadRovCam.FRONTArm facing camera looking exactly at the robotic armRovCam.ARMMisc cameras looking wherever we need to position them (still not supported in this version)RovCam.MISC1
RovCam.MISC2ROV-control 🕹It is a python sub-module that simplifies the use ofpymavlinkAPIs, to ease the control of our beloved Alenda (the ROV).How to use it 🔧Establish communication 🤝# create an instance of RovMavlink# Those are the default constructor params.rov=RovMavlink(connection_type='udpin',connection_ip='0.0.0.0',connection_port='14550',silent_mode=True)# Binds to the port in the given addressrov.establish_connection()To start controlling thevehicle you should Arm it first. To arm it use there following commands.# Silent mode is used to shut off prints from the used functions for instance - > 'vehicle Armed successfully'rov=RovMavlink(silent_mode=False).establish_connection()rov.arm_vehicle()# you only need to arm the vehicle once, there is no need to arm it every time you want to stablize it# to disarm vehiclerov.disarm_vehicle()Set vehicle mode 🎯rov=RovMavlink().establish_connection()rov.arm_vehicle()rov.set_vehicle_mode(rov.Mode.STABILIZE)Those are all the modes you would need to use. If you usedset_vehicle_mode()with any thing other that Mode enum it would raise a violation ❌.classMode(IntEnum):STABILIZE=0ACRO=1ALT_HOLD=2AUTO=3GUIDED=4CIRCLE=7SURFACE=9POSHOLD=16MANUAL=19# use them as follows# rov.set_vehicle_mode(Mode.STABILIZE)sending custom control 🎮⚠ Take care the throttle of x, y, z and rotation is a value between-1 to 1. any value out side this boundry will raise a violation. ❌🔞rov.send_control(JoyStickControl(x_throttle=0.5,y_throttle=0.5,z_throttle=0,rotation_throttle=1))also you can it as follows ⬇rov=RovMavlink(silent_mode=False).establish_connection()period=10# period for moving the joystick control in secondsrov.arm_vehicle()# my_lovely_fake_joy_stick = JoyStickControl(x_throttle=1, y_throttle=1) # name the param u want to add and give it a value between -1 to 1my_lovely_fake_joy_stick=JoyStickControl(y_throttle=0.8)rov.send_control(my_lovely_fake_joy_stick)Orientation of the ROV 🧭AuthorsKarim KohelYoussef AbbasMostafa Wahdan