Giter Club home page Giter Club logo

elevator-server's Introduction

Elevator server

In the TTK4145 elevator project the elevator hardware is communicated with over TCP. Every elevator expose a server that clients (elevator logic) can connect to. This repo contains the code for the server part of the elevator interface.

Usage

Dependencies

Hardware & comedi

For this program to work elevator hardware needs to be connected through an io card supported by comedi in the same way as it is in the NTNU real time lab. It is made specially to work with the elevator hardware in this lab, and it is not recommended to use this software for outside this lab. For a solution that will work outside the real time lab, have a look at one of the simulators (Simulator v2, Simulator v3).

Cargo & Rust

To compile and install the elevator server, cargo and rust is needed. Both are best installed by using rustup.

HW Access

For a process to access the io card (elevator hw) on the real time lab the user running the user running the process must be in the iocard group. To add user student to the iocard group run sudo usermod -a -G iocard student.

Install

If the software is not installed you can run cargo install ttk4145_elevator_server to run install it. If an old version is installed and you wish to upgrade to the newest version cargo install --force ttk4145_elevator_server will do.

Run

The server can be started by running ElevatorServer. Once started, the server will start listening on localhost:15657. You can then connect to it by using a client that adhers to the protocol.

Clients

Protocol

  • All TCP messages must have a length of 4 bytes
  • The instructions for reading from the hardware send replies that are 4 bytes long, where the last byte is always 0
  • The instructions for writing to the hardware do not send any replies

Write

Writing command[0] command[1] command[2] command[3]
Reserved x x x x
Motor direction 1 direction[-1(255),0,1] x x
Order button light 2 button[0,1,2] floor
[0..NF]
value[0,1]
Floor indicator 3 floor[0..NF] x x
Door open light 4 value[0,1] x x
Stop button light 5 value[0,1] x x

Read

Reading command[0] command[1] command[2] command[3] response[0] response[1] response[2] response[3]
Order button 6 button[0,1,2] floor[0..NF] x 6 active[0,1] 0 0
Floor sensor 7 x x x 7 at floor[0,1] floor[0..NF] 0
Stop button 8 x x x 8 active[0,1] 0 0
Obstruction switch 9 x x x 9 active[0,1] 0 0

elevator-server's People

Contributors

kjetilkjeka avatar tharaldyo avatar

Watchers

 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.