MRPT / GSoC2018-discussions

2 stars 3 forks source link

Web Frameworks Library for MRPT (Rachit Tibrewal) #6

Open jolting opened 6 years ago

jolting commented 6 years ago

Initial Description

Robots are slowly becoming a part of the internet of things, and easy control and universal access will be a step in future of robotics. MRPT’s Web Framework Library should address this problem.A lightweight publisher/subscriber mechanism needs to be created for MRPT. The C++ server library and the javascript library will then leverage this to create further applications. There will be two libraries, a C++ server library for RPC on the robot. Another will be a javascript library which provides modules for such procedure calls.This task involve serialization of existing mrpt objects for JSON transfer, RPC protocol, websocket setup, 3D rendering of objects in js, reusable js components for sending and receiving data from user created app where the user is largely benefitted from easy to use library methods and objects.


rachit173 commented 6 years ago

Hello @jolting, @jlblancoc Thanks for giving me this opportunity. I am very excited about the project and working with mrpt community. I would like to contribute to some issues and read codebase till May 5, as my exams will continue till that date, after that I will start working towards the first phase.

jolting commented 6 years ago

Hi @rachit173, At this point I would just like to confirm that you're able to build MRPT. If you're using Linux I would recommend Ubuntu 18.04 since the compiler is already up to date. On Windows of course you'll need MSVC 2017. I don't personally develop on OS X, so I'm very little help there.

y73isc00l commented 6 years ago

I had built it about 20 days ago on 16.04, I will install 18.04 and build MRPT.

On Apr 25, 2018 01:40, "Hunter Laux" notifications@github.com wrote:

Hi @rachit173 https://github.com/rachit173, At this point I would just like to confirm that you're able to build MRPT. If you're using Linux I would recommend Ubuntu 18.04 since the compiler is already up to date. On Windows of course you'll need MSVC 2017. I don't personally develop on OS X, so I'm very little help there.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MRPT/GSoC2018-discussions/issues/6#issuecomment-384063677, or mute the thread https://github.com/notifications/unsubscribe-auth/AXfDdDmc-JrweT5M6-8lzBl836mRFLYmks5tr4bCgaJpZM4Tguu2 .

rachit173 commented 6 years ago

Sorry for the confusion, i am creating by using my alternate GitHub account y73isc00l.I will continue to use rachit173. I am installing 18.04 now.

rachit173 commented 6 years ago

@jolting I have built mrpt-2.0.0 from source on Ubuntu 18.04. Building the apps was giving error so I turned it off for build. Also I tried to install ROS(kinetic-kame) on 18.04 but there seems to be no version available, is there a workaround?

jolting commented 6 years ago

ROS melodic is not ready yet. You can install a few packages from the archive.

If you need to run ROS kinetic you can use a docker container. http://wiki.ros.org/docker/Tutorials/GUI

Do you need that to compare against ros3djs?

rachit173 commented 6 years ago

Yes, since 3d visualisation is going to be similar to ros3djs,it would be better to have it in the same os. Also I was thinking about rosmrpt.

On Apr 27, 2018 07:01, Hunter Laux notifications@github.com wrote:

ROS melodic is not ready yet. You can install a few packages from the archive.

If you need to run ROS kinetic you can use a docker container. Melodic http://wiki.ros.org/docker/Tutorials/GUI

Do you need that to compare against ros3djs?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/MRPT/GSoC2018-discussions/issues/6#issuecomment-384836705, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfSEAtKN-aYiUmB57mEFX4VbkZO-LOSuks5tsnT7gaJpZM4Tguu2.

jolting commented 6 years ago

Sure. MRPT does have some ROS bindings.

https://github.com/mrpt-ros-pkg/mrpt_navigation

ROS has a lot of packages and a large community of users. It's nice to be able to take advantage of all of that. I use ROS all the time. I encourage you to learn all you can from what the RobotWebTools guys have done with rosbridge_server and ros3djs.

However, we do want you to implement an MRPT specific version that is not coupled to ROS. Here are a few reasons:

  1. I think potentially a non-ROS solution can be much more cohesive and usable with MRPT.
  2. We want it to be much more portable than ROS.
  3. PUB/SUB and RPC should be optimized for web. For example, rosbridge_server naively converts everything to JSON. This might not always be the right thing to do. You can send binary blobs over a websocket.
jlblancoc commented 6 years ago

Hi @rachit173 !

Also I tried to install ROS(kinetic-kame) on 18.04 but there seems to be no version available, is there a workaround?

ROS melodic will be available within a few weeks (during May 2018).

I agree with @jolting 's view of making the web interface independent of ROS (although it could be later integrated as a ROS node) for the sake of portability; also, using all format options should be considered for the transport layer: binary blobs, JSON,... The former will probably be much more efficient, so in case of using JSON, there should be good reasons to pick that choice. Cheers.

rachit173 commented 6 years ago

Hi My exams are almost over, I have one easy paper left for May 9. So I can start with work. Should I start with the first phase work?

jolting commented 6 years ago

Sure. That's the occupancy grid task right?

rachit173 commented 6 years ago

It is the publisher/subscriber mechanism for MRPT.

jolting commented 6 years ago

Cool. You may begin coding any time you wish.

jolting commented 6 years ago

@rachit173 Do you have some time in the next few days to have a quick video chat to discuss your project?

I'm in California. I presume you're in India, so your morning will probably works best for me.

rachit173 commented 6 years ago

I am free tomorrow morning any time from 8:00 Indian Standard Time(GMT+5:30). Any particular hour?

On May 10, 2018 10:03, Hunter Laux notifications@github.com wrote:

@rachit173https://github.com/rachit173 Do you have some time in the next few days to have a quick video chat to discuss your project?

I'm in California. I presume you're in India, so your morning will probably works best for me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/MRPT/GSoC2018-discussions/issues/6#issuecomment-387949289, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfSEAmNKh79a2C3T5j8y4Qfd9uykPLQoks5tw8MygaJpZM4Tguu2.

rachit173 commented 6 years ago

@jolting @jlblancoc For the publisher subscriber pattern , I am confused between brokered systems(like ROS with the roscore or master) or brokerless system. In ROS the broker accepts all the publishers messages and distributes the messages to subscribers requesting the message. The master can also be used for RPC. So should i continue with a brokered system like ROS or are there some other design patterns which would be more advantageous for our purpose of web apps?

jolting commented 6 years ago

ROS core doesn't distribute the messages. It acts like a name service allowing nodes to connect with each other, but the nodes do talk directly with each other for performance reasons. Messages aren't relayed.

ZeroMQ has a good description of broker vs brokerless. http://zeromq.org/whitepapers:brokerless

This project isn't intended to reinvent ROS. There are two actors in this system. A web browser and an MRPT server.

A single point to point data channel such as a websocket doesn't need a broker. You can still implement pub/sub at the protocol layer.

See ethereum: https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB

rachit173 commented 6 years ago

cppethereum is great but it does not have websocket support unlike goeth, but basic code of cppethereum rpc with beast library could solve this. Also I have created mrpt-server personal repo, I will be pushing code to it and have started with basic configuration file till I get a clarity of the RPC. Should I continue with my repo or can you create a new repo for mrpt-server.

jolting commented 6 years ago

Ethereum is just an example of RPC. I would not suggest adding that as a dependency.

I prepared this template a while back: https://github.com/MRPT/mrpt-web

You can fork that or start your own.

rachit173 commented 6 years ago

Update: forked mrpt-web. created a sync web server for ws using beast The ws connection works in chrome but firefox does not. For firefox, the site says that SSL is required thus, I will create a separate app for SSL. Appart from synchronois, asynchronous and coroutine ws server, much of the code is present in beast documentation. I am thinking of placing the different servers in CWebSocketServer.h file

jolting commented 6 years ago

Ok. You can send a pull request to the mrpt-web repo when you want to review your changes.

rachit173 commented 6 years ago

@jolting @jlblancoc I have implemented jsonrpccpp using websockets and pushed it to my fork. The code is based mostly on cppethereum and works with jsonrpc-2.0 js client (I tried with plain websockets). However, it currently does not support SSL and thus does not work with firefox sometimes. I am currently working on it. Currently the file implementing websocket server is CWebSocketJsonRpcServer.h but I suspect that it is not doing a clean exit and thus if I immediately run the server on the same port it gives errors but after sometime it works fine. Any pointers regarding that?

Regarding dependencies, beast has a header files in beast/experimental which were giving error when I removed the included files.

Also regarding licenses and credits, I have copied lot of code from cppethereum, should i just include their license or put it at start of every code file used?

jolting commented 6 years ago

I have implemented jsonrpccpp using websockets and pushed it to my fork. The code is based mostly on cppethereum and works with jsonrpc-2.0 js client (I tried with plain websockets).

To avoid licensing issue you should rewrite the sections you based on cppethereum. Code derived from GPL code cannot be BSD code.

Regarding dependencies, beast has a header files in beast/experimental which were giving error when I removed the included files.

You should use beast as it is shipped with boost 1.66 or later.

rachit173 commented 6 years ago

Update : Pushed websocket with SSL. Reading up on rosbridge protocol It has the following operations:

jolting commented 6 years ago

Minimalism is key here.

Think of a way to version the protocol. There a reason why MRPT can still read old data files despite all the changes over the years. Backward compatibility requires some thought. I would start with some way of versioning the protocol.

Services are actually ROS's way of doing RPC Request/Reply. I would look at that next.

The following are related to ROS's pub/sub

advertise
unadvertise
subscribe
unsubscribe

I certainly wouldn't start with Pub/Sub.

rachit173 commented 6 years ago

check this link for mrpt-web protocol https://github.com/rachit173/mrpt-web/wiki I have added the protocol associated with mrpt-web, method call protocol has already been implemented. We can decide the protocol in the wiki and it will also serve as basic documentation. Please suggest changes in protocol there. Also I am confused about converting different message or parameters like costmap, point, laserscan data type to json fields for the transport. Should i use ROS's message type as they already have this available or some other package. Once this conversion package is done, I will create a basic app to demonstrate the method call protocol.

jolting commented 6 years ago

I have added the protocol associated with mrpt-web, method call protocol has already been implemented. We can decide the protocol in the wiki and it will also serve as basic documentation. Please suggest changes in protocol there.

Awesome. Documentation is key.

Also I am confused about converting different message or parameters like costmap, point, laserscan data type to json fields for the transport. Should i use ROS's message type as they already have this available or some other package.

This should be done for MRPT data structures.

I think it should be possible to create something like CArchive for JSON. https://github.com/MRPT/mrpt/blob/master/libs/serialization/include/mrpt/serialization/CArchive.h

jlblancoc commented 6 years ago

👍 for starting documenting things since the beginning in a wiki. Keep that!

I think it should be possible to create something like CArchive for JSON. https://github.com/MRPT/mrpt/blob/master/libs/serialization/include/mrpt/serialization/CArchive.h

Hmmm... After this GSOC project, there will be THREE different serialization protocols:

It would be fantastic if we could somehow centralize all serialization methods in one single place, as far as it may be possible without breaking what currently works.

A first simple idea (that needs more thinking, I don't mean it's optimal) would be adding new methods to CArchive to writeXXX() and readXXX() for XXX=mex|json, for example. The methods should accept variables and their "name". Another place to look for unification, is the triplet of virtual methods of CSerializable. I'm not sure if it would be feasible (it depends on whether JSON serializations require the variable names in addition to their values), but it would be fantastic to allow existing code to automatically work if the CArchive that is passed had some "flag" to reflect which serialization protocol is desired: binary or JSON (MEX is so different that I don't think we have chances of unifying it here...).

Notice that CArchive is the place where "serialization" happens. That class actually is in charge of interpreting data to/from a text or binary stream, which may be an underlying mrpt::io::CStream or a std::stream.

jolting commented 6 years ago

it depends on whether JSON serializations require the variable names in addition to their values

Yeah JSON needs a schema.

A solution could look like this:

template <typename SCHEMA_CAPABLE>
SCHEMA_CAPABLE CPose2D::serializeTo() const
{
  SCHEMA_CAPABLE out; 
  out["x"]    = m_coords[0];
  out["y"]    = m_coords[1];;
  out["phi"] = m_phi;
  return out;
}

Then you can do.

  CPoint2D point;
  auto json_point = point.serializeTo<Json::Value>();

A little bit more complicated version would be

template <typename SCHEMA_CAPABLE>
SCHEMA_CAPABLE SomeObject::serializeTo() const
{
  SCHEMA_CAPABLE out;
  out["nested"]    = m_somenested.serializeTo();
  return out;
}

Clearly, this could get a little bit more declarative, but might as well start with something simple.

rachit173 commented 6 years ago

I am facing the following error

CMakeFiles/mrpt-ws-rpc.dir/main.cpp.o: In function `mrpt::serialization::CSerializable::~CSerializable()':
main.cpp:(.text._ZN4mrpt13serialization13CSerializableD2Ev[_ZN4mrpt13serialization13CSerializableD5Ev]+0xf): undefined reference to `vtable for mrpt::serialization::CSerializable'
CMakeFiles/mrpt-ws-rpc.dir/main.cpp.o: In function `mrpt::poses::CPoint2D::operator delete(void*)':
main.cpp:(.text._ZN4mrpt5poses8CPoint2DdlEPv[_ZN4mrpt5poses8CPoint2DdlEPv]+0x14): undefined reference to `mrpt::aligned_free(void*)'
CMakeFiles/mrpt-ws-rpc.dir/main.cpp.o: In function `mrpt::serialization::CSerializable::CSerializable()':
main.cpp:(.text._ZN4mrpt13serialization13CSerializableC2Ev[_ZN4mrpt13serialization13CSerializableC5Ev]+0x1b): undefined reference to `vtable for mrpt::serialization::CSerializable'
CMakeFiles/mrpt-ws-rpc.dir/main.cpp.o: In function `mrpt::poses::CPoint2D::CPoint2D(double, double)':
main.cpp:(.text._ZN4mrpt5poses8CPoint2DC2Edd[_ZN4mrpt5poses8CPoint2DC5Edd]+0x36): undefined reference to `vtable for mrpt::poses::CPoint2D'
main.cpp:(.text._ZN4mrpt5poses8CPoint2DC2Edd[_ZN4mrpt5poses8CPoint2DC5Edd]+0x44): undefined reference to `vtable for mrpt::poses::CPoint2D'
CMakeFiles/mrpt-ws-rpc.dir/main.cpp.o: In function `CRPCRawLog::Playlist_GetItems()':
main.cpp:(.text._ZN10CRPCRawLog17Playlist_GetItemsEv[_ZN10CRPCRawLog17Playlist_GetItemsEv]+0x43): undefined reference to `Json::Value mrpt::poses::CPoint2D::serializeTo<Json::Value>() const'
CMakeFiles/mrpt-ws-rpc.dir/main.cpp.o: In function `mrpt::rtti::TRuntimeClassId const* mrpt::rtti::CLASS_ID_impl<mrpt::rtti::CObject>()':
main.cpp:(.text._ZN4mrpt4rtti13CLASS_ID_implINS0_7CObjectEEEPKNS0_15TRuntimeClassIdEv[_ZN4mrpt4rtti13CLASS_ID_implINS0_7CObjectEEEPKNS0_15TRuntimeClassIdEv]+0x5): undefined reference to `mrpt::rtti::CObject::GetRuntimeClassIdStatic()'
CMakeFiles/mrpt-ws-rpc.dir/main.cpp.o: In function `mrpt::poses::CPoint2D::~CPoint2D()':
main.cpp:(.text._ZN4mrpt5poses8CPoint2DD2Ev[_ZN4mrpt5poses8CPoint2DD5Ev]+0xf): undefined reference to `vtable for mrpt::poses::CPoint2D'
main.cpp:(.text._ZN4mrpt5poses8CPoint2DD2Ev[_ZN4mrpt5poses8CPoint2DD5Ev]+0x1d): undefined reference to `vtable for mrpt::poses::CPoint2D'
collect2: error: ld returned 1 exit status
apps/mrpt-ws-rpc/CMakeFiles/mrpt-ws-rpc.dir/build.make:105: recipe for target 'apps/mrpt-ws-rpc/mrpt-ws-rpc' failed
make[2]: *** [apps/mrpt-ws-rpc/mrpt-ws-rpc] Error 1
CMakeFiles/Makefile2:140: recipe for target 'apps/mrpt-ws-rpc/CMakeFiles/mrpt-ws-rpc.dir/all' failed
make[1]: *** [apps/mrpt-ws-rpc/CMakeFiles/mrpt-ws-rpc.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

main.cpp

#include <jsonrpccpp/server/abstractserverconnector.h>

#include <mrpt/poses/CPoint2D.h>
#include <mrpt/serialization/CSerializable.h>
#include <mrpt/rtti/CObject.h>
#include <mrpt/web/CWebSocketUtility.hpp>
#include <mrpt/web/CWebSocketAdvanced.h>
#include <mrpt/web/CModularServer.h>

#include <CRPCRawLogFace.h>

#include <cstdlib>
#include <functional>
#include <thread>
#include <string>
#include <mutex>
#include <memory>

using namespace mrpt::poses;
class CRPCRawLog : public CRPCRawLogAbstract
{
public:
  virtual RPCModules implementedModules() const override
  {
    return RPCModules{RPCModule{"CRPCRawLog","1.0"}};
  }
  Json::Value Playlist_GetPlaylists() override
  {
    Json::Value ch;
    ch[0]["name"] = "Jabberwock";
    ch[0]["chapter"] = 1;
    ch[1]["name"] = "Cheshire Cat";
    ch[1]["chapter"] = 6;
    ch[2]["name"] = "Mad Hatter";
    ch[2]["chapter"] = 7;

    // create the main object
    Json::Value val;
    val["book"] = "Alice in Wonderland";
    val["year"] = 1865;
    val["characters"] = ch;
  return ch;
  }
  Json::Value Playlist_GetItems() override
  {
   //Added this code
    CPoint2D point;
    auto jsonPoint = point.serializeTo<Json::Value>();
    return jsonPoint;
  }
};

CPoint2D.cpp

template <typename SCHEMA_CAPABLE>
SCHEMA_CAPABLE CPoint2D::serializeTo() const
{
    SCHEMA_CAPABLE out;
    out["x"] = m_coords[0];
    out["y"] = m_coords[1];
    return out;
}

Also since templatized virtual functions are not allowed, how to add it to CSerializable.h

rachit173 commented 6 years ago

The above error was due to not linking the libraries properly, that is solved. I am thinking of adding this serialization method to MRPT data structures as you have suggested, in the form of templatized serializeTo function. Adding the message type could be useful for js library later like,

out["datatype"] = "CPose2D";
jolting commented 6 years ago

That seems reasonable. Also, this is important for serializeFrom. You might want to add a version as well.

rachit173 commented 6 years ago

I will adding the JSON schemas in this wiki and have added some Schema for poses. https://github.com/rachit173/mrpt-web/wiki/JSON-serialization-of-MRPT-Data-Structures Also,

/** Templatized serializeTo function */
template <typename SCHEMA_CAPABLE>
SCHEMA_CAPABLE serializeTo() const
{
    SCHEMA_CAPABLE out;
    out["datatype"] = this->GetRuntimeClass()->className;
    out["version"] = 1;
    out["x"] = m_coords[0];
    out["y"] = m_coords[1];
    return out; 
}

/** Templatized serializeFrom function 
 * Serializes only if the datatype matched to className 
*/
template <typename SCHEMA_CAPABLE>
void serializeFrom(SCHEMA_CAPABLE& in)
{
    uint8_t version = in.get("version",0);
    if(in["datatype"] == this->GetRuntimeClass()->className)
    {
        switch(version)
        {
            case 1:
            {
                m_coords[0] = in["x"];
                m_coords[1] = in["y"];
            }
            break;
            default:
                MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version)
        }
    }
}

Are these serialization functions fine?

rachit173 commented 6 years ago

Update:

  1. Added cmake file for making changes to stub generated by jsonrpc for use by our project. One can generate stub (slight modification of jsonrpc stub) by specifying the json specification and using jsonrpcstub_create macro in cmake.

  2. The remote procedure call can be generated as and when required by adding the specification json, generating stub and adding its object to CModularServer.

  3. I need to use RPC to create Publish / Subscribe advertisements as well as calls. For this, the protocol has been described in this wiki.

  4. Since we have not developed any Pub/Sub mechanism, for the purpose of creating the web apps later, should I use ros_master api and build a wrapper around it for Publishing and Subscribing to topics. This wrapper will be based on the stub generated in this code. Then I can use mrpt libraries along with ROS Pub/Sub for server side code of the apps.

I am currently working on serialization and will start work on the RPC Pub/Sub wrapper once decided.

rachit173 commented 6 years ago

ROS's pub/sub

advertise
unadvertise
subscribe
unsubscribe

I had started working on the above, the main issue here is keeping track of clients (for sending messages from server to client without a signal). Currently I have created a store class with a map(map<string,shared_ptr>) and plan to use the string as the unique identifier for the client. So the subscribe message would look llike,

{
"method":Subscriber.subscribe
"params":
{
 "clientID": key,
 "topic" : topic,
 "throttle_rate"......
}
}

Now the subscribe method in the derived class of the stub will have access to the store and can use this to add the connection object to corresponding topic in a SubscribeManager class instance. Similarly the connection object will contain the new subscribed topic.

A good decision of the key may be needed to address security issues. I was thinking of sending a randomly generated unique identifier to the client on connection and using that identifier as the key.

This is a vague, I am currently working on the code. But wanted your suggestions. The main issue facing here is keeping track of client connection for sending messages from subscribed topics to corresponding client.

rachit173 commented 6 years ago

I am developing the stubs related to the above in dev-pubsub. Also I have tried to clean up the large number of commits into much smaller number of commits depicting the logical sequence of development.

rachit173 commented 6 years ago

@jolting I have removed dependancy from jsonrpccpp by adding self written RPC handler. Currently, I am developing it and the RPC PubSub in dev-rpc-pubsub. The changed protocol has been added to the wiki.

jolting commented 6 years ago

Avoid mixing common.js style imports and es6 style imports. ES6 imports are preferred.

I'm wondering if RxJS could be used in lieu of EventEmitter2. What do you think?

For unit testing do you have a preference for mocha? Jest seems a little more popular and I have more experience with it.

Good work so far on the JS stuff, so far. I'm excited to see something fully working and demonstrable.

rachit173 commented 6 years ago

I am looking into RxJS, maybe at a more mature stage of library,using it would be good. I don't have a preference for mocha(it seems easy to use), I will learn jest and change the unit test to it. I am facing an issue currently, the bundled js generated by webpack seems to have errors, is it common, I am trying to debug it but any leads would be good.

jolting commented 6 years ago

Looks like you're trying to use the ws module in client-side code.

Here's an example how one library solved it: https://github.com/maxogden/websocket-stream/blob/3f39dcbc098f661ee12d7deba297b1420a0a0e07/package.json#L43

https://github.com/maxogden/websocket-stream/blob/3f39dcbc098f661ee12d7deba297b1420a0a0e07/ws-fallback.js

rachit173 commented 6 years ago

That works :).

rachit173 commented 6 years ago

Update: Developed modules for:

jolting commented 6 years ago

Good work.

It would be nice to make coloring the clouds a configurable parameter in javascript. Common coloring parametizations include axis, depth and flat color. Of course if the point cloud has color then it should be an option. I find it useful to switch between these when trying to understand data.

I don't think colorFromDepth is a necessary parameter.

@jlbancoc care to share any insight?

jlblancoc commented 6 years ago

Hi guys,

Ok, I'll take a look at this tomorrow (CEST).

As a newbie regarding serious js development, did you already included some detailed instructions in your fork on how to launch some demo(s)? If not, please add it to the readme/wiki/wherever and I'll beta test it ;-)

Cheers

El lun., 25 jun. 2018 22:11, Hunter Laux notifications@github.com escribió:

Good work.

It would be nice to make coloring the clouds a configurable parameter in javascript. Common coloring parametizations include axis, depth and flat color. Of course if the point cloud has color then it should be an option. I find it useful to switch between these when trying to understand data.

I don't think colorFromDepth is a necessary parameter.

@jlbancoc care to share any insight?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MRPT/GSoC2018-discussions/issues/6#issuecomment-400079726, or mute the thread https://github.com/notifications/unsubscribe-auth/AFPj2gO3q4hbr3mbb6u5lqkjSSFw-7BLks5uAUPpgaJpZM4Tguu2 .

rachit173 commented 6 years ago

wiki added.

jlblancoc commented 6 years ago

Thanks!

Just a minor edit to the wiki... there's a missing "cd":

git clone https://github.com/rachit173/mrpt-web-js.git cd mrpt-web-js npm install

However, I found errors during "npm install". Apparently, a missing dependency (?).

 ├─┬ schema-utils@0.4.5 
│ │ └─┬ UNMET PEER DEPENDENCY ajv@6.5.1

...

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.4
npm WARN optional Skipping failed optional dependency /sane/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.4
npm WARN optional Skipping failed optional dependency /watchpack/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.4
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none was installed.
npm WARN mrpt-web-js@1.0.0 No repository field.
npm ERR! Linux 4.4.0-128-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! babel-env@2.4.1 postinstall: `node ./bin/babel-env`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the babel-env@2.4.1 postinstall script 'node ./bin/babel-env'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the babel-env package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/babel-env
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs babel-env
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls babel-env
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/jlblanco/code/mrpt-web-js/npm-debug.log
jolting commented 6 years ago

npm ERR! node v4.2.6 npm ERR! npm v3.5.2

The 4 branch of node is EOL.

Typically you'll want to install a new version of node: https://nodejs.org/en/download/package-manager/

It's also typical to upgrade npm. You can use npm. npm i -g npm@latest

You'll need root priviledges unless you set .npmrc to use a different node prefix.

That might not be the problem, but it's a good place to start.

jlblancoc commented 6 years ago

Indeed, that was the problem! :-) Tests now run smoothly.

On the wiki: "will created in the dist folder after running build". Please, provide the direct command for building (as a beginner with nodejs, all these steps were not trivial to me ;-): something like: npm run-script build

I was able to build the js lib and run the basic 3D html demo, good!

Now, on the original question:

It would be nice to make coloring the clouds a configurable parameter in javascript. Common coloring parametizations include axis, depth and flat color. Of course if the point cloud has color then it should be an option. I find it useful to switch between these when trying to understand data.

I completely agree with Hunter here. Size of points should be configurable as well. Color from height is not a bad idea of something to have, since it's useful when handling large pointclouds, but it's a low priority feature.

I would say it's far more important to add:

PS @jolting : what do you think about adding some example HTML pages to the repo with examples? Would it be "good practices"? (It would require building the package first...)

PS2: What do you think about adding a "bigger picture" graph / schematic (could be done even in PowerPoints / LibreOffice Impress) with the role of each repo in this project?: MRPT, mrpt-web, mrpt-web-js,... (user apps?)

rachit173 commented 6 years ago

Surely, a bigger picture is good for the project understanding. I will plan and make it. I was planning to simultaneously start with web app version of RawLogViewer. So, in which repository should this app belong? For the C++ part of the app, I am thinking of adding that to mrpt-web repo. Also, which are the core features of RawLogViewer which should be started with?

About RawLogViewer App: Through this app I will basically demonstrate how instead Qt or wx gui, we can use Web UI with RPC by creating stubs for required functions. Is the basic theme correct?

jolting commented 6 years ago

Examples are good.

It's common after libraries have been made unopinionated to create VueJS or React component libraries around them. Many times both a ReactJS and a VueJS version are created because the war is very much on.

https://hasvuepassedreactyet.surge.sh/ Star VueJS please. 👍

Once they've been wrapped in components it tends to make reuse quite a bit easier and examples based on components might be more useful in the long run.