diff --git a/README.md b/README.md index 0aeda1d..97f2f48 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,16 @@ This will set up Underwater Robotics @ Berkeley's team simulator. +# VMWare Instructions + +Install VMWare Workstation Pro/Fusion with Berkeley's license from here https://software.berkeley.edu/vmware. Then download a base Ubuntu 16 desktop image from https://releases.ubuntu.com/16.04/. Now create a new virtual machine and give the Ubuntu image as the disc file. Now you can run the VM and set it up with your username and password. + +After you first log in, open up a terminal with Ctrl+Alt+T or search for it and then get our code with + + git clone https://github.com/berkeleyauv/robosub.git + +Now you can follow the commands in the Dockerfile to install ROS, Gazebo, and the UUV simulator. + # Mac Instructions ## --Installation-- diff --git a/descriptions/urab_sub_description/urdf/urab_sub_actuators.xacro b/descriptions/urab_sub_description/urdf/urab_sub_actuators.xacro index 8c055f8..865da69 100644 --- a/descriptions/urab_sub_description/urdf/urab_sub_actuators.xacro +++ b/descriptions/urab_sub_description/urdf/urab_sub_actuators.xacro @@ -2,7 +2,7 @@ @@ -16,23 +16,23 @@ - - + dyn_time_constant="0.2" + rotor_constant="0.000004"> - - + - + - + - + - + + + - - + + - + + + + + + + + + - - - - - + diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/CHANGELOG.rst b/descriptions/urab_sub_thruster_manager/CHANGELOG.rst similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/CHANGELOG.rst rename to descriptions/urab_sub_thruster_manager/CHANGELOG.rst diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/CMakeLists.txt b/descriptions/urab_sub_thruster_manager/CMakeLists.txt similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/CMakeLists.txt rename to descriptions/urab_sub_thruster_manager/CMakeLists.txt diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/config/TAM.yaml b/descriptions/urab_sub_thruster_manager/config/TAM.yaml similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/config/TAM.yaml rename to descriptions/urab_sub_thruster_manager/config/TAM.yaml diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/config/thruster_manager.yaml b/descriptions/urab_sub_thruster_manager/config/thruster_manager.yaml similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/config/thruster_manager.yaml rename to descriptions/urab_sub_thruster_manager/config/thruster_manager.yaml diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/launch/thruster_manager.launch b/descriptions/urab_sub_thruster_manager/launch/thruster_manager.launch similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/launch/thruster_manager.launch rename to descriptions/urab_sub_thruster_manager/launch/thruster_manager.launch diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/package.xml b/descriptions/urab_sub_thruster_manager/package.xml similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/package.xml rename to descriptions/urab_sub_thruster_manager/package.xml diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/scripts/thruster_allocator.py b/descriptions/urab_sub_thruster_manager/scripts/thruster_allocator.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/scripts/thruster_allocator.py rename to descriptions/urab_sub_thruster_manager/scripts/thruster_allocator.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/setup.py b/descriptions/urab_sub_thruster_manager/setup.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/setup.py rename to descriptions/urab_sub_thruster_manager/setup.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/__init__.py b/descriptions/urab_sub_thruster_manager/src/uuv_thrusters/__init__.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/__init__.py rename to descriptions/urab_sub_thruster_manager/src/uuv_thrusters/__init__.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/__init__.py b/descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/__init__.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/__init__.py rename to descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/__init__.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster.py b/descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster.py rename to descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_custom.py b/descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_custom.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_custom.py rename to descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_custom.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_proportional.py b/descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_proportional.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_proportional.py rename to descriptions/urab_sub_thruster_manager/src/uuv_thrusters/models/thruster_proportional.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/thruster_manager.py b/descriptions/urab_sub_thruster_manager/src/uuv_thrusters/thruster_manager.py similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/src/uuv_thrusters/thruster_manager.py rename to descriptions/urab_sub_thruster_manager/src/uuv_thrusters/thruster_manager.py diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/srv/GetThrusterCurve.srv b/descriptions/urab_sub_thruster_manager/srv/GetThrusterCurve.srv similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/srv/GetThrusterCurve.srv rename to descriptions/urab_sub_thruster_manager/srv/GetThrusterCurve.srv diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/srv/GetThrusterManagerConfig.srv b/descriptions/urab_sub_thruster_manager/srv/GetThrusterManagerConfig.srv similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/srv/GetThrusterManagerConfig.srv rename to descriptions/urab_sub_thruster_manager/srv/GetThrusterManagerConfig.srv diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/srv/SetThrusterManagerConfig.srv b/descriptions/urab_sub_thruster_manager/srv/SetThrusterManagerConfig.srv similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/srv/SetThrusterManagerConfig.srv rename to descriptions/urab_sub_thruster_manager/srv/SetThrusterManagerConfig.srv diff --git a/descriptions/urab_sub_control/urab_sub_thruster_manager/srv/ThrusterManagerInfo.srv b/descriptions/urab_sub_thruster_manager/srv/ThrusterManagerInfo.srv similarity index 100% rename from descriptions/urab_sub_control/urab_sub_thruster_manager/srv/ThrusterManagerInfo.srv rename to descriptions/urab_sub_thruster_manager/srv/ThrusterManagerInfo.srv diff --git a/descriptions/vortex_descriptions/launch/robosub_world.launch b/descriptions/vortex_descriptions/launch/robosub_world.launch index 7b21e8b..83c56a8 100644 --- a/descriptions/vortex_descriptions/launch/robosub_world.launch +++ b/descriptions/vortex_descriptions/launch/robosub_world.launch @@ -1,13 +1,13 @@ - - + @@ -47,7 +47,7 @@ pose: position: [0, -50, -10] east: - plane: [100, 0.1, 20] + plane: [100, 0.1, 20] pose: position: [0, 50, -10] diff --git a/descriptions/vortex_descriptions/launch/robosub_world_sub.launch b/descriptions/vortex_descriptions/launch/robosub_world_sub.launch index 8521394..cf66ee9 100644 --- a/descriptions/vortex_descriptions/launch/robosub_world_sub.launch +++ b/descriptions/vortex_descriptions/launch/robosub_world_sub.launch @@ -1,12 +1,12 @@ - - - - + + + diff --git a/scripts/read_cameras.py b/scripts/read_cameras.py new file mode 100644 index 0000000..f164c16 --- /dev/null +++ b/scripts/read_cameras.py @@ -0,0 +1,61 @@ +import rospy +from sensor_msgs.msg import Image +from cv_bridge import CvBridge + +class ImageListener: + """ Abstract class. Subscribes to ROS Image messages. Used for getting camera image data + from the simulator and converting it for OpenCV. """ + + def callback(self, img_msg): + bridge = CvBridge() + # Stores as a BGR array for OpenCV. + cv_image = bridge.imgmsg_to_cv2(img_msg, desired_encoding='bgr8') + self.images.append(cv_image) + + def get_images(self, time): + self.images = [] + rospy.sleep(time) # time is in seconds + return self.images + + def get_images_forever(self): + self.images = [] + rospy.spin() + return self.images + +class FrontCameraListener(ImageListener): + """ Gets image data from the front camera. """ + def __init__(self): + self.subscr = rospy.Subscriber("/urab_sub/urab_sub/camerafront/camera_image", + Image, self.callback) + +class UnderCameraListener(ImageListener): + """ Gets image data from the bottom camera. """ + def __init__(self): + self.subscr = rospy.Subscriber("/urab_sub/urab_sub/cameraunder/camera_image", + Image, self.callback) + +if __name__ == '__main__': + # not sure if this should be moved into the ImageListener class + rospy.init_node('img_listener', anonymous=True) + + front_listen = FrontCameraListener() + imgs = front_listen.get_images(1.0) + + print "FRONT CAMERA" + print "ImageListener.get_images() has type " + str(type(imgs)) + print "Length of image list: " + str(len(imgs)) + print "The first image has type " + str(type(imgs[0])) + print "The first image has dimensions " + str(imgs[0].shape) + print "Print out the first image:" + print imgs[0] + + under_listen = UnderCameraListener() + imgs = under_listen.get_images(1.0) + + print "\n\nBOTTOM CAMERA" + print "ImageListener.get_images() has type " + str(type(imgs)) + print "Length of image list: " + str(len(imgs)) + print "The first image has type " + str(type(imgs[0])) + print "The first image has dimensions " + str(imgs[0].shape) + print "Print out the first image:" + print imgs[0] diff --git a/scripts/show_images.py b/scripts/show_images.py new file mode 100644 index 0000000..07b4674 --- /dev/null +++ b/scripts/show_images.py @@ -0,0 +1,21 @@ +import rospy +import numpy as np +import cv2 +import read_cameras + +def display_camera_images(listener, time, window_name="video"): + """Displays camera images received from an ImageListener object, which + gets video data for the specified amount of time, in seconds.""" + imgs = listener.get_images(1.0) + for frame in imgs: + cv2.imshow(window_name, frame) + # you need to hold a key to see the video progress. Press q to quit. + if cv2.waitKey(0) & 0xFF == ord('q'): + break + cv2.destroyAllWindows() + + +if __name__ == '__main__': + rospy.init_node('img_listener', anonymous=True) + front_listen = read_cameras.FrontCameraListener() + display_camera_images(front_listen, 1, "front camera")