Project Orb::Connect Web Edition

kamaz

Unicorn hunter
Addon Developer
Joined
Mar 31, 2012
Messages
2,298
Reaction score
4
Points
0
Last update (2014-02-03) in RED.

Orb::Connect Web Edition

Bringing Orbiter into the Web era!

Launch checklist:

1. Unpack the attached add-on
2. Enable OrbConnect.dll module.
3. Launch the simulation.
4. Open http://127.0.0.1:38888/ in a Web browser.
5. Try clicking around the panel :)

picture.php


FAQ

Why??? Because. Seriously, you don't see how this can be useful?

What browser does it work with? I have tested with Firefox. Any modern browser should work -- the client-side code is not abusive in any way.

Orbiter hangs when I use RCS controls. Try disabling OrbiterSound.

Firefox hangs when clicking the engine controls. It will unhang after a few seconds.

I don't like layout of the controls! No problem, just edit www\index.html to suit your needs.

I want to add more controls or make my own panel. Have a look at www\example.html to see how this is done.

Does it work over the network? Of course. Just make sure that your firewall is not blocking incoming connections to TCP port 38888.

Does it work with my phone/tablet? It does with my Android 4.0 tablet:

picture.php


Can I have multiple clients? Of course.

Can I have multiple panels? Sure. Just make several .html files and use browser tabs or something.

Can this be used to control X? If X is accessible via Orb::Connect, then yes. See Doc\OrbConnect\OrbConnectUserGuide-2.1.pdf.

My simpit already uses Orb::Connect server! I'm not going to rewrite everything to run over HTTP! There is no need. The Orb::Connect server operates the same as in stock version, on port 37777.

How does it work? I have added an HTTP server to Orb::Connect. This server has two functions. First, it serves files located under "www" directory. Second, if the client sends a POST request to /cgi with Orb::Connect commands, these commands are passed to Orb::Connect core, and the result is returned to the client. On the client side, there is a JavaScript library which handles communication with the server.

Can you put it in normal terms? There is a web server in Orbiter. Your browser connect to the web server, and loads the HTML file with the panel layout. The JavaScript code in that file handles updates.

Are you saying that I can control spacecraft using a web browser? Yes!

What is the update frequency? It is set on the client, with the parameter passed to OrbiterClient::start(). The included examples use 5Hz.

What is the impact on frame rate? I have not observed any. It should be very small, because the HTTP server is written in a non-blocking way.

Did you write the HTTP server yourself? No. I have used mongoose.

What about license? Both Orb::Connect and mongoose are under GPL, so the resulting combination is under GPL.

Where is the source code? Included in the download, under Orbitersdk directory.

What modifications did you make to Orb::Connect? Not many. I have added 4 files implementing the web server functionality (http.cpp, http.h, mongoose.c, mongoose.h) and added needed hooks in OrbConnect.cpp. Everything else is unchanged.


REVISION HISTORY
Rev. 19, 2014-02-23
Make the tabbed interface default
Fix SHIP:FOCUS:STATUS2 crash.
Update docs.
Add engine control.
Add about dialog
Implement truster control.
VesselCommandParser.cpp: use thruster groups instead of engine groups (bring code in line with documentation :))
orbiterclient.js: add helped function for SHIP:FOCUS:SENDBUFFEREDKEY
example.html: add example for sendBufferedKey
XRVesselCtrl.h: upgrade to 3.0 (vdrorb)
XRCtlCommandParser.cpp: bugfix: setDescentHoldAP could not set TargetDescentRate (vdrorb)
XRCtlCommandParser.cpp: add new fields from XRVesselCtrl API 3.0 (vdrorb)
VesselCommandParser.cpp: add SendBufferedKey (vdrorb)

Initial release (2.1-web), 2014-02-23
 

Attachments

  • OrbConnect-2.1-web.zip
    434.5 KB · Views: 146
  • hailprobe.zip
    2.3 KB · Views: 77
  • OrbConnect-rev19.zip
    574.3 KB · Views: 104
Last edited:

vdrorb

Member
Joined
Jan 23, 2011
Messages
16
Reaction score
0
Points
16
thumbs up

elegant, straight to the point coded

AND .. winderful timing .. i just got permission for a simpit from my wife:thumbup: and started to do the same in python (because cross using it later on raspeberry pi for hardware control) ...

the only thing left, making a new thread for collecting all changes in orbconnet (vncmfd changes a little bit, i added some missing xctrl values like hull tempearture for myself....

realy nice work, thx
Stefan
 

asbjos

tuanibrO
Addon Developer
Joined
Jun 22, 2011
Messages
697
Reaction score
264
Points
78
Location
This place called "home".
Looks great!
But could you clarify for me how to use this on another computer? I wanted to try it on my phone, but I don't know what to do.

And by the way, why aren't you releasing this on Orbit Hangar?
 

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
Looks great!
But could you clarify for me how to use this on another computer? I wanted to try it on my phone, but I don't know what to do.

Press Win + R, type "cmd", enter "ipconfig", then note the first "IPv4" entry (may be the second card), then replace "127.0.0.1" by the actual IP adress in your phone.

Assuming that your phone and your PC are connected in the same network. (for example by wireless connection)
 

kamaz

Unicorn hunter
Addon Developer
Joined
Mar 31, 2012
Messages
2,298
Reaction score
4
Points
0
And by the way, why aren't you releasing this on Orbit Hangar?

Because I have asked yagni01 to integrate this into "official" Orb::Connect and I'm waiting for his response. There's no sense to maintain two separate source trees, as my changes will work with any future enhancements of Orb::Connect.

(because cross using it later on raspeberry pi for hardware control)

Raspberry is a very cool little computer, but badly suited for hardware control, because: (1) it has very little I/O pins, (2) I/O pins are connected directly to the CPU, so pin overvoltage can damage/kill the chip (which is not replaceable), (3) there is no A/D converter and (4) it reboots at the slightest disturbance in the power supply.

In my opinion, Arduino (plus a stack of replacement ATMega328P's) is a much better route. You can even have an Ethernet interface :)
 

vdrorb

Member
Joined
Jan 23, 2011
Messages
16
Reaction score
0
Points
16
In my opinion, Arduino (plus a stack of replacement ATMega328P's) is a much better route. You can even have an Ethernet interface :)

short answer: :) you are right,
e.g. the Arduino Mega has 54 input/outputs with 14 PWM for all the simpit blinking and beeping, but you have to protect them too

but the PI has one big advantage .. i have one


now entering the NERD-Zone .. you have been warned ...dont read further
----------------------------------------------

NOOO never .. beacuse ... i dont know, BUT

i have one PI and therfor its the best, and beside nerds are always right.
finaly you need external stuff anyhow to control several 7 segments, led, switches ..
for all the good reasons my simpit should be homemade and cheap (in sense of money :rofl: (beacuse there is also a wife and other expensive hobbies :facepalm:
so what are the choices? 1. use what you have
the PI is a full computer so you just jump in with your favorite scripting language, bla bla
but if i want 30 switches and 100 leds (7 segments, all indicators bla blup beep) so lets see...

big computer, harware IO = 0 (well ignoring good old printer port hacking) price 1000 Euro

rasperry pi, not bad, full feature computer 8 IOs well if you are re-using the onboard I2C, SPI, UART and the 2nd port you got 19 IO, price 40 Euros

small computer TI MSP mikrokontoller launchpad 5 EUROs
8-16 IOs and through launchpad direct USB communication

smallest one
TI MSP without launchpad 1-2 Eruos 8-16 IOs well, you need some IO for some kind of communication SPI,i2c with somebody

more IOs for lamps and switches
8 bit shift register, 30cents 8 switches or 8 eight led (if you need more than 15mA per channel add 20 cent for a driver

the msp is big enough to run some programs on it like shown here
speaking to i2c temperture sensor, a 2,4GHz sending receiving module, UART
(woman acceptance factor is much higher if you dont have cables ::thumbup:)

(Sending/receiving 2.4Ghz, pluged in via usb into a hacked settopbox used as homecontrol station)

MSP reading a digital tempearture chip via I2c and sending it via a 2.4GhZ tranceiver module)

and finaly .. i have no idea what it will be, but i will lkeep you informed :-D


Stefan :hailprobe:
 

4throck

Enthusiast !
Joined
Jun 19, 2008
Messages
3,502
Reaction score
1,008
Points
153
Location
Lisbon
Website
orbiterspaceport.blogspot.com
Interesting... very interesting because HTML+CSS+JS is my thing.

Will certainly try to get a working 2D panel for some historical vessels using this!
 
Last edited:

blixel

Donator
Donator
Joined
Jun 29, 2010
Messages
647
Reaction score
0
Points
16
Awesome. I just downloaded this and tested it by connecting my Android tablet to the Orb connect server. It works! And it's so cool! I love the idea of being able to control the vessel by pressing the associated button on the tablet instead of using keyboard commands.
 

BruceJohnJennerLawso

Dread Lord of the Idiots
Addon Developer
Joined
Apr 14, 2012
Messages
2,585
Reaction score
0
Points
36
So, just to clarify: The plugin allows my computer to act as a server which processes commands & sends them to Orbiter right? So wouldn't this also work as a way of doing multiplayer? It would probably be a strain on the server to handle multiple connections, but otherwise using it for multiplayer would be quite simple.

Does it only work through the XRvessel API, or was that just a small thing with the example?

A little thing to request: virtual numpad on the window, so I can manually control the craft from there. The autopilots are sometimes much too sluggish for really big vessels.
 

Ripley

Tutorial translator
Donator
Joined
Sep 12, 2010
Messages
3,135
Reaction score
409
Points
123
Location
Rome
Website
www.tuttovola.org
Brilliant add-on!


Here comes a bug report even if I can live with that, given that IE is not my primary browser:

I'm on XP, and IE8 doesn't work, while FF does.
Whenever I click, IE displays (bottom left) "Errore nella visualizzazione della pagina", which translates into something like "Page visualization error"

- If I click on Orbiter window (LIN/ROT & other autopilots), both browsers' buttons react and are updated.
- If I click on IE window, IE buttons simply don't react to mouseclicks, FF buttons don't change and Orbiter doesn't receive input.
- If I click on FF window, IE buttons are updated and Orbiter receives input.
 

vdrorb

Member
Joined
Jan 23, 2011
Messages
16
Reaction score
0
Points
16
OrbConnect ..next version bugfix

by the way.. i cant find a active OrbConnect thread ?? am i looking wrong?
i would like a contribute a small bugfix for the next version

XCTL:SetDescentHold not working correct (you can not set vs speed)

Fix: XRCtlCommandParser.cpp Line 732
732 - : converted = CommandParser::doubleFromString(tokens.at(3), state.TargetDescentRate);
should be:
732 + : converted = CommandParser::doubleFromString(tokens.at(4), state.TargetDescentRate);
 
Last edited:

kamaz

Unicorn hunter
Addon Developer
Joined
Mar 31, 2012
Messages
2,298
Reaction score
4
Points
0
Will certainly try to get a working 2D panel for some historical vessels using this!

Cool.

May I ask everyone to post your panels in this thread for other people to use? :)

So, just to clarify: The plugin allows my computer to act as a server which processes commands & sends them to Orbiter right?

Basically, yes. It's actually original Orb::Connect that does this, I have just extended it so you can use Web browser as a client. Previously, you had to write your own client application to benefit from Orb::Connect at all -- which is why the idea never really took off I think. With this version it's much simpler because you can make your panel / mission control app / whatever in HTML+JS. A lot of people know how to make web pages and it's much easier to learn.

So wouldn't this also work as a way of doing multiplayer?

In principle yes, but it would be a bad way of doing multiplayer, due to how Orb::Connect protocol works (and Orb::Connect over HTTP would be even worse). It was developed for simpit building, so it makes some design decisions which make a lot of sense for simpits (i.e. the data format is human-readable) but are bad choice for implementing multiplayer. If I had to implement multiplayer myself I'd rather build upon the code I wrote for master/slave renderer. Not that I have ambitions to reimplement OMP...

Does it only work through the XRvessel API, or was that just a small thing with the example?

It works with everything that is exposed through Orb::Connect proper, but I have used XR interface in examples due to coolness factor. If you're not flying XR, you'll still have the clock and autopilot panels.

A little thing to request: virtual numpad on the window, so I can manually control the craft from there.

Noted. Requires extending the Orb::Connect core (I think) but is perfectly doable.

I'm on XP, and IE8 doesn't work, while FF does.

Uh. IE, the bane of web developers... I'll have a look, but I'm not promising anything :)

by the way.. i cant find a active OrbConnect thread ?? am i looking wrong?
i would like a contribute a small bugfix for the next version

Thanks.

It appears that we currently don't have an active Orb::Connect thread (I have seen some unanswered bug reports in the support forum). So, please use this thread for reporting any issues which come up. If the original devs do not show up, I will add bugfixes/extensions and release an updated version. Good thing the original code was under GPL. :)
 

vdrorb

Member
Joined
Jan 23, 2011
Messages
16
Reaction score
0
Points
16
It appears that we currently don't have an active Orb::Connect thread (I have seen some unanswered bug reports in the support forum). So, please use this thread for reporting any issues which come up. If the original devs do not show up, I will add bugfixes/extensions and release an updated version. Good thing the original code was under GPL. :)

Well in this case ... i have some more OrbConnect thingies running on myself which maybe are of common interesst:

XR Hulltemperature
adding to XCTL:SysStatus to give back all new values like Hull Tempearture from the newset XR Api 3.0
XRCtlCommandParser.cpp Line 783ff (getSystemStatus)
CoolantTemp; // in degrees C
NoseconeTemp; // in Kelvin
LeftWingTemp; // in Kelvin
RightWingTemp; // in Kelvin
etc pp and all the other new stuff..

and i have a SHIP:sendBufferedKey function that sends a keypress to a vessel so my simpit/orbconnect can also control vessel/bases without API
 

blixel

Donator
Donator
Joined
Jun 29, 2010
Messages
647
Reaction score
0
Points
16
Quick video I made for my YT channel showing this add-on:

 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,934
Reaction score
245
Points
138
Location
Cape
You've found the Holy Grail.

---------- Post added 01-28-14 at 03:12 AM ---------- Previous post was 01-27-14 at 11:27 PM ----------

Could this be used to operate the buttons on MFDs?
 

Ripley

Tutorial translator
Donator
Joined
Sep 12, 2010
Messages
3,135
Reaction score
409
Points
123
Location
Rome
Website
www.tuttovola.org
...Could this be used to operate the buttons on MFDs?
I'd love to see ROT/LIN switch move according to clicks on browser window, but maybe it's a bit too much as a request (if it's doable at all).
 
Last edited:

kamaz

Unicorn hunter
Addon Developer
Joined
Mar 31, 2012
Messages
2,298
Reaction score
4
Points
0
Could this be used to operate the buttons on MFDs?

It can be used for that (the command is ORB:processMFDButton), but it cannot be used to diplay MFD screen on the tablet. For that, you have VNCMFD:

http://orbiter-forum.com/showthread.php?t=28474
Last version: http://orbiter-forum.com/showthread.php?p=411088&postcount=93

---------- Post added at 12:22 PM ---------- Previous post was at 12:19 PM ----------

I'd love to see ROT/LIN switch move according to clicks on browser window, but maybe it's a bit too much as a request (if it's doable at all).

You mean the switch in the cockpit? It moves for me, both with DG and XR2. What vessel are you using?
 

Izack

Non sequitur
Addon Developer
Joined
Feb 4, 2010
Messages
6,665
Reaction score
13
Points
113
Location
The Wilderness, N.B.
A quick question (forgive me for not testing this or the original Orb::Connect), is it possible to use this to send keypresses to vessels?
 
Top