Git Product home page Git Product logo

vu-arma-dev / arma-teleop-camera-haptic Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 3.0 5.65 MB

This repository provides utilities for user interface Qt integrations in teleoperation including cameras accessed with opencv and haptic devices. It is currently working with Force Dimension haptic devices, but is avaliable to work with other haptic devices.

QMake 0.15% C++ 94.23% C 5.48% Objective-C 0.14%

arma-teleop-camera-haptic's Introduction

ARMA-TeleOp-Camera-Haptic

Authors: Ellie Fitzpatrick, Jason Pile, and [Long Wang] (https://github.com/wanglong06)

This repository provides utilities for user interface Qt integrations in teleoperation including cameras accessed with opencv and haptic devices. It is currently working with Force Dimension haptic devices, but is avaliable to work with other haptic devices.

Table of Contents


QCvCamera

QCvCamera makes it easy to stream video from a camera through USB.

To use include QCvCamera and QCvFilter:

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{

   ui->setupUi(this);
   cam = new QCvCamera(this);
   scene = new QGraphicsScene();
   ui->graphicsView->setScene(scene);
   cam->setOutputView(ui->graphicsView);
   QApplication::connect(cam, SIGNAL(imageReady(QImage)), this, SLOT(updateDisplay(QImage)));
}

Features

  • Takes snapshots
  • Change cameras
  • Implement multiple cameras
  • Clear the buffer

Dependencies

OpenCv: core, highgui, imgprocessing, video, feature, legacy, flann, nonfree, calibration, contribution .

The libraries below should be in your project file of qt if you are using qt.

  INCLUDEPATH += “The path to the location of your opencv .lib files”  
  LIBS +=        opencv_core249.lib \  
                 opencv_highgui249.lib \  
                 opencv_imgproc249.lib \  
                 opencv_video249.lib \  
                 opencv_features2d249.lib \  
                 opencv_legacy249.lib \  
                 opencv_flann249.lib \  
                 opencv_nonfree249.lib \  
                 opencv_calib3d249.lib \  
                 opencv_contrib249.lib  

Installation

Pull the repository and link the files in the project file. Use the repository for your camera need!

Getting Started

  • Create a new QCvCamera
  • Create a new QGraphics Scene
  • Go to the ui, add a Graphics View and take notice of it’s name
  • ui->graphicsView-> setScene( your QGraphicsScene)
  • set the output view of your camera to your graphics view
  • Create a slot, updateImage(QImage img), which:
    • clears the graphics scene
    • adds the a pixmap to the qgraphics scene (which is the paramater QImage)
  • connect QCvCamera’s signal image ready to your slot update image

Example Code

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
   ui(new Ui::MainWindow)
{

   ui->setupUi(this);
   cam = new QCvCamera(this);
   scene = new QGraphicsScene();
   ui->graphicsView->setScene(scene);
   cam->setOutputView(ui->graphicsView);
   QApplication::connect(cam, SIGNAL(imageReady(QImage)), this, SLOT(updateDisplay(QImage)));
}

MainWindow::~MainWindow()
{
   delete ui;
}

void MainWindow::updateDisplay(QImage img)
{
   scene->clear();
   scene->addPixmap(QPixmap::fromImage((img)));
}

Omega7 Udp

This project was built for use with the Omega 7 device created by Force Dimension, but can be used in any circumstance that requires forces, position, and orientation to be sent. This sends information about force, position, and orientation over udp. Has been tested with Linux and Windows.

Features

  • Keeps track of position, orientation, and force
  • Makes it easy to use the QUdpSocket!

Dependencies

  • Qt Framework
  • Eigen version 3.2.1

Installation

Clone the repository and use as a library in project.

Getting Started

  • Create an Omega7Udp object. The constructor contains a boolean value that is whether it is a force udp or not.
  • Create a QTimer that will be used to fetch the position, orientation, and forces from the Omega7Udp object.
  • You will need to create 2 Slots:
    • startUdp()
      • this connects the udp to the values inputted (with omega7object->setAddress and omega7object->setPort) to the udp socket
      • start the timer to update the udp
    • updateUdp()
      • every time the timer times out this slot
      • gets the forces from the force object or gets the position from the postion object depending on which is is recieving
      • sends the forces or position depending on which the computer is sending
  • Connect startUdp() to a command that you have set. Make sure you have set the port and address
  • Connect updateUdp() to the QTimer’s timeout() signal
  • Let it run!

Example Code

//Somewhere in this code you need to set the forces and position. ARMA gets this from the omega7, but you need to set it 
//for your current haptic device
MainWindow::MainWindow(QWidget *parent) :
   QMainWindow(parent),
   ui(new Ui::MainWindow)
{
   ui->setupUi(this);

   force = new Omega7Udp(1);
   pose = new Omega7Udp(0);

   udpUpdateTimer = new QTimer(this);

   QApplication::connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startUdp()));
   QApplication::connect(udpUpdateTimer, SIGNAL(timeout()), this, SLOT(updateUdp()));
  }

MainWindow::~MainWindow()
{
   delete ui;
}

void MainWindow::startUdp()
{   //logic to make sure all fields are filled in
   force->setAddress(“192.168.1.15”);
   force->setPortNumber(20000);
   pose->setAddress( “192.168.1.102”);
   pose->setPortNumber(25000);

   pose->connect();
   force->connect();

   udpUpdateTimer->start(1000);
   }
}

void MainWindow::updateUdp()
{
   getPose();
   pose->sendPose();
   force->recieveForce();
   updateForces();
}
}

Ellie's Final Demo

Ellie's Final Demo is under the examples folder. It incorporates both Omega7Udp and QCvCamera. It is run with Qt. Here are the steps to make it work

  1. Install Qt (version 5.3)
  2. Install Eigen library 3.2.1 (https://bitbucket.org/eigen/eigen/downloads/)
  3. Install Force Dimension Omega7 (program & API)
  4. Install OpenCV (2.4.9 for windows) (http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.9/opencv-2.4.9.exe/download)

Troubleshooting

  1. In the “.pro” file
    • Check the Eigen directory.
    • Check the Force Dimension directory.
  2. Check the opencv directory. (check the version number “opencv_corexxx”, replace them accordingly)
  3. Try to run the program via the executable file
    • If not working because of “missing dll”, put the following “.dll” in the “exe” folder
      • “opencv_core249.dll” & “opencv_core249d.dll”
      • “opencv_highgui249.dll” & “opencv_highgui249d.dll”
      • “opencv_imgproc249.dll” & “opencv_imgproc249d.dll”

Contribute

Support

If you are having issues, please let us know. Email Ellie Fitzpatrick ([email protected]) or Long Wang ([email protected])

License

Copyright [2015] [ARMA Laboratory]

FAQ

arma-teleop-camera-haptic's People

Contributors

wanglong06 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.