Giter VIP home page Giter VIP logo

poseidon's Introduction

Poseidon

This repository contains the software for Poseidon and its new twin PoGen2, USU's latest autonomous submarines.

This submarine is the third generation of our submarine, built by the mechanical, electrical, and software engineers at Utah State University.

The quality of Poseidon sets it apart from previous generations of submarines. Poseidon contains cutting edge hardware, has an easy to maintain design, and cleaner code.

Setting up Poseidon

Beaglebone Black

Poseidon uses a Beaglebone Black as its main computer. From a clean install of Beaglebone Black Debian run

apt-get install g++ cmake
cd Poseidon/Scripts
./compileMain.sh

The NodeJS on the Beaglebone Black may need to be updated.

Arduino Due

Poseidon uses an Arduino Due as its hardware controller. Follow the install instructions in ArduinoController/README.md.

Use

Web Interface

To test via the built-in web server, run the following in cloud9 or SSH terminal

cd Poseidon/BoneCentral/WebApplication
node index.js

In a browser, enter the IP address of the Beaglebone Black (ie. 192.168.1.7) and a web interface will appear

Autonomous Mode

To run Poseidon's autonomous code, run the following in cloud9 or SSH terminal

cd Poseidon/BoneCentral/Brain
node initialize.js

Poseidon will wait for its action switch to be inserted before moving. Removing the action switch will cause Poseidon to stop all of its motors.

poseidon's People

Contributors

butterfieldj avatar camilne avatar crknight avatar emersonudy avatar jesse-v avatar kburgon avatar konnorandrews avatar madfrog54321 avatar nfcopier avatar octoshrimpy avatar samachr avatar tekuconcept avatar windowwasher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

poseidon's Issues

MotorController does not accelerate gently in some situations

Currently the MotorController is aware of the state of the thrusters and will accelerate gently to a target speed. However, this is not the case when mixing pitch/yaw with x/y/z movement. Some thrusters will instantly jump from their old state to the new one to make the movement or to execute a turn.

Decreased Performance in Socket Server

Noticed a decrease in server performance lately - however that may have been just a result of slow packet transfer or an efficiency problem in either packet transfer or level of interpretation. Reverted to original Server w/o pwm for forensic investigation.

Add IMU Controller

We need to be able to receive data from the IMU.

  • IMU Controller is initialized with a connection to the Node app.
  • IMU Controller receives data from the drivers.
  • Node app has interface to the IMU Controller.

The I feel like the best implementation is to have the Node interface constantly pulling for data and caching the most recent data set.

*A note on acronyms in code: The generally accepted convention for acronyms in code is to capitalize only the first letter, i.e.: ImuController vs IMUController.

Recent Order(s)

Order Application 1:

  • 4x BeagleBone Blacks
  • 4x OV5642 1080p Cameras
  • 8x Heat Sensors
  • 10x Current Sensors
  • 1x IMU

Various Camera Communication Circuitry and Components:
LEDs, Fiber Optics, Op-Amps, Photoresistors, Transistors, Resistors, Breadboards, Wire


Order Application 2:

  • 4x TI Differential Transmitter ICs
  • 4x TI Differential Receiver ICs
  • 4x Water Sensors

Various Circuitry and Components:
Resistors, Capacitors

Design Protocol for PRU

As it turns out from another electrical engineer's light research, writing to a file on the BeagleBone to continuously toggle a GPO only yields about a 2KHz emulated clock speed - slower than the slowest baud rate in the Arduino's Serial communication.

That is:
2KHz / 5 Latency = 400B/s
400B.s / 9B.msg = 44M/s

This is still decent but for elements that need to be updated more than twice a second, this is not fast enough. The BeagleBone Black does offer two on-board PRU peripherals (Programmable Real-Time Units). Based on the same research above, it has been found that the PRU can emulate a 2 - 25MHz clock speed - faster than the Arduino it's self.

That is:
2MHz / 5 Latency = 400KB/s
400KB.s / 9B.msg = 45KM/s

So all C++ code for the 'ArduBone Protocol' must be ported over to PRU assemebly. An external program can make a call to send or receive data with the appropriate parameters.

Camera Read Error from Power Failure

During an attempt to read from camera registers, all read-in's returned '0'. Re-evaluating the wiring, one of the lines was found to be an open-circuit, thus the camera was never powered through any previous tests - making all observed results false-positives.

ESCs go into brake mode, preventing reverse

Brake mode occurs when moving from forwards to backwards. This can be prevented by writing -0.1, 0, and then the backwards velocity. The cycling undoes the break.

Likewise, the ESCs need to cycle to 30% and then 0 before they can be used.

Minimum velocities

The minimum rate to turn the propellers in the left/right direction seems to be 0.29, and the minimum for Z seems to be 0.24. The software should take this into account.

Race conditions on responses from server

Sometimes two JSON objects will be returned simultaneously in the same connection, which causes parsing issues. They should be separated and handled individually.

Ruby does not show C++ exceptions

The C++ API classes are designed to throw exceptions when something goes wrong, such as passing an invalid argument (-11) to a method, or creating a second instance of ThrustController. Ruby shows "unknown C++ exception" but doesn't show the exception text. This makes debugging Ruby-side very difficult.

Add JS Unit Tests

We need to add a unit testing framework for the Brain. Jasmine is a solution I've used before. I don't know whether it's the best for Node integration.

Get useful coordinates

Requirements:

  • PiVision gets location of each pole it finds on X axis
  • PiVision translates coordinates of each pole to lie on a grid with the origin at the center of PiVision's sight

Add C++ tests

ThrustController and possibly CommandDispatcher should be tested.

Doxygen Documentation

The current application has lost much of it's Doxygen comments. These need to be updated. In addition, we need to make sure all of the author comments at the top of files are correct.

Add Power Controller

We need a power controller to turn on the ESCs. The ESC driver should implement the IPowerModule interface and live in the Dirvers directory. The power controller should implement the IPowerController interface and live in the Peripherals directory.

  • Arduino can toggle ESCs.
  • Add Beaglebone driver for ESCs
  • Add PowerController
  • Add PowerController interface in Node app
  • CommandDispatcher dispatches PowerController commmands

Attach and Test Brushless Motors with Bone

Though the bone's socket server had successfully implemented pwm signal processing, some ESCs require arming and other special signals for revers control.

  • Objective: arm 4-6 ESCs and control forward and reverse motions with remote.
  • Bonus objective: arm within 1-5 seconds

Add LightController

We need a way to turn on/off the lights on the sub. I kinda feel like it makes more sense for the lights to be turned on when the app is started and are left on.

  • Define light interfaces
  • Arduino can control lights
  • Add light controller
  • Add light driver
  • Lights switched on during bootstrap

Build & Design Observation Webpage

One tab per feature:

  • Motor Control & Status
  • Visuospatial 3D Map, Navigation, Basic Sensor Readings
  • Hull Integrity & Detailed Sensor Readings

Add Simple Node Web Application

This should be as simple as possible. Nothing fancy or pretty. This should be just enough to be able to give directions to and get sensor data from the sub remotely.

Interface Camera to Processing Unit

Read in HSYNC buffer from camera and write to processor. VSYNC validates a single frame. (The OV7670 camera defaults to approximately 30FPS at 32kp/frame while the OV5642 defaults to approximately 15FPS at 5mp/frame.)

Create raw YUV image file from buffers.

Fix "Inappropriate ioctl for device" Error

If the Arduino crashes or is unplugged when the application is running, this error occurs. The current solution is to reboot the machine, or in a worst case scenario, require a power-cycle.

Perhaps restarting the USB device interface will resolve the issue.

(a less common condition is when the USB hardware shuts down and the drivers are still functional)

Update Thrust Controller

Ensure we can communicate with the thrusters.

  • Thrust Controller is initialized with a connection to the Node app.
  • Thrust Controller communicates with all the correct drivers.
  • Node app has an interface to communicate with the Thrust Controller.

We need to pay extra care to making the Thrust Controller real time. Queuing tasks for the drivers should be avoided.

class IThrustController {
  virtual void GoDirection(int forward, int strafe, int dive) = 0;
  virtual void FaceDirection(int yaw) = 0;
}
class IThruster {
  virtual void Thrust(int powerLevel) = 0;
}

Can detect gate

Requrements:

  • A method called in BoneCentral's brain initializes detection
  • PiVision gets an image and detects at least one pole

Brushless Motor Control Debugging A

I added PWM support to the remote server and all seems to be working fine based on LED tests. Unfortunately, initialization is still having a few problems at the moment. Aside from that, the next stage is to include said arming sequence to enable full ESC functionality.

Function faceDirection receives angles instead of magnitudes

Currently the function faceDirection doesn't take an angle as its parameter, but it takes a magnitude. In order to facilitate autonomous functions, faceDirection needs to take an angle as its parameter and be able to make the sub turn at that angle.

IMUSensor segfault

Attempts by Ruby to read from the IMUSensor cause Ruby to stop immediately. I suspect a segfault or similar signal.

Arduino Hangs on Bad Input

When an index value outside the bounds of the controller array is passed to the Arduino, the microcontroller becomes unresponsive and requires a physical reset. Should we add a watchdog timer or just go simple and catch all bad input?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.