All Projects → nilsbore → roswasm_suite

nilsbore / roswasm_suite

Licence: other
Libraries for compiling C++ ROS nodes to Webassembly using Emscripten

Programming Languages

C++
36643 projects - #6 most used programming language
javascript
184084 projects - #8 most used programming language
c
50402 projects - #5 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to roswasm suite

Ncine
A cross-platform 2D game engine
Stars: ✭ 372 (+500%)
Mutual labels:  imgui, emscripten
imgui
Dear ImGui Addons Branch = plain unmodified dear imgui plus some extra addon.
Stars: ✭ 348 (+461.29%)
Mutual labels:  imgui, emscripten
rotation master
Provide conversion between the major representations of 3D rotation and visualize the orientation of a rigid body
Stars: ✭ 157 (+153.23%)
Mutual labels:  imgui, emscripten
Imguifiledialog
File Dialog for ImGui : https://github.com/aiekick/ImGuiFileDialog
Stars: ✭ 398 (+541.94%)
Mutual labels:  imgui, emscripten
Imgui Js
JavaScript bindings for Dear ImGui using Emscripten and TypeScript
Stars: ✭ 510 (+722.58%)
Mutual labels:  imgui, emscripten
Hello imgui
Hello, Dear ImGui: cross-platform Gui apps for Windows / Mac / Linux / iOS / Android / Emscripten with the simplicity of a "Hello World" app
Stars: ✭ 120 (+93.55%)
Mutual labels:  imgui, emscripten
Glchaos.p
3D GPUs Strange Attractors and Hypercomplex Fractals explorer - up to 256 Million particles in RealTime
Stars: ✭ 590 (+851.61%)
Mutual labels:  imgui, emscripten
Imguizmo.quat
ImGui GIZMO widget - 3D object manipulator / orientator
Stars: ✭ 187 (+201.61%)
Mutual labels:  imgui, emscripten
Jsonapi Rb
Efficiently produce and consume JSON API documents.
Stars: ✭ 219 (+253.23%)
Mutual labels:  serialization
Thorsserializer
C++ Serialization library for JSON
Stars: ✭ 241 (+288.71%)
Mutual labels:  serialization
Libcbor
CBOR protocol implementation for C
Stars: ✭ 215 (+246.77%)
Mutual labels:  serialization
Api struct
API wrapper builder with response serialization
Stars: ✭ 224 (+261.29%)
Mutual labels:  serialization
Jsonapi Rails
Rails gem for fast jsonapi-compliant APIs.
Stars: ✭ 242 (+290.32%)
Mutual labels:  serialization
Schematics
Project documentation: https://schematics.readthedocs.io/en/latest/
Stars: ✭ 2,461 (+3869.35%)
Mutual labels:  serialization
Cereal
A C++11 library for serialization
Stars: ✭ 2,986 (+4716.13%)
Mutual labels:  serialization
Krate
A SharedPreferences wrapper powered by Kotlin delegates
Stars: ✭ 213 (+243.55%)
Mutual labels:  serialization
Mashumaro
Fast and well tested serialization framework on top of dataclasses
Stars: ✭ 208 (+235.48%)
Mutual labels:  serialization
json to cpp
Generate C++ class from JSON data
Stars: ✭ 42 (-32.26%)
Mutual labels:  serialization
Unicorn
A Sitecore utility designed to simplify deployment of Sitecore items across environments automatically
Stars: ✭ 252 (+306.45%)
Mutual labels:  serialization
Hprose Html5
Hprose is a cross-language RPC. This project is Hprose 2.0 Client for HTML5
Stars: ✭ 237 (+282.26%)
Mutual labels:  serialization

roswasm_suite

Build Statuslicense

Libraries for compiling C++ ROS nodes to Webassembly using Emscripten. Allows you to write C++ ROS nodes similar to how you would otherwise, and to then have them run in a webbrowser and communicate with ROS through rosbridge_websocket.

Dependencies

Building

catkin build is recommended, since catkin_make might leak configurations to other packages. Make sure to source the Emscripten environment before building the package:

source /path/to/emsdk/emsdk_env.sh
catkin build

Packages

Writing a roswasm node

The roswasm client library presents an API similar to roscpp, with the main differences being that most interfaces are heap allocated, and that Emscripten manages the event loop. Below is a shortened version of the corresponding listener example implementation.

#include <emscripten.h>
#include <roswasm/roswasm.h>
#include <std_msgs/String.h>

roswasm::NodeHandle* n;
roswasm::Subscriber* sub;

void chatterCallback(const std_msgs::String& msg)
{
    printf("I heard: [%s]\n", msg.data.c_str());
}

void loop() {}

extern "C" int main(int argc, char** argv)
{
    n = new roswasm::NodeHandle();
    sub = n->subscribe<std_msgs::String>("chatter", chatterCallback);
    emscripten_set_main_loop(loop, 10, 1);
    return 0;
}

For more complete examples, see the roswasm_tutorials package.

Building a roswasm package

The roswasm library uses catkin to build an emscripten project. All you have to do in your package that is using roswasm is to add it as a dependency in your cmake file and link against ${roswasm_LIBRARIES}. It will automatically set the Emscripten em++ compiler as the default for building and linking nodes. Note that you have to install and source the emscripten SDK before building your workspace. The following minimal cmake file includes a guard to check that Emscripten is present.

cmake_minimum_required(VERSION 2.8.3)
project(listener)

find_package(catkin REQUIRED COMPONENTS roscpp roswasm std_msgs)
catkin_package()

if (DEFINED ENV{EMSDK})

include_directories(${catkin_INCLUDE_DIRS})
add_executable(listener src/listener.cpp)
set_target_properties(listener PROPERTIES OUTPUT_NAME "listener.js")
target_link_libraries(listener ${roswasm_LIBRARIES})
configure_file(www/listener.html ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/listener.html COPYONLY)

endif()

Running an Emscripten node

Run node separately

Before starting any of the roswasm nodes, you need to have one instance of rosbridge_websocket running:

roslaunch rosbridge_server rosbridge_websocket.launch

After building your node, you can run it similar to the following command:

rosrun roswasm run.py _pkg:=roswasm_tutorials _node:=listener.html _display_port:=8080

This will start a webserver and allow you to view the page at localhost:8080. If you want to see the output from the node, open the browser debug console.

Combined launch file (alternative)

There is a also a convenience launch file to run both rosbridge_websocket as well as your roswasm node at the same time:

roslaunch roswasm run_server.launch pkg:=roswasm_tutorials node:=listener.html
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].