A virtual controller for ROS using NippleJS and Rosbridge.
- Build the image
docker compose build ros_joy_js
- Run the local web server
docker compose run ros_joy_js
- Get your IP
hostname -I
and navigate tohttp://192.168.21.33:5000
(replace your ip)
Freewheeling inside the container to run custom commands: docker compose run ros_joy_js bash
- Match dependencies:
- Ros Melodic
- Node package manager
apt install nodejs npm
- Node packages
npm i express fs ip
- Source this env and run
roslaunch ros_joy_js ros_joy_js
- Get your IP
hostname -I
and navigate tohttp://192.168.21.33:5000
(replace your ip)
ros_joy_js.launch
: Main application, launches local web server. Optional args:port
: where to host the apptopic
: topic where Twist messages will be published to
test.launch
: Launchesros_joy_js.launch
PLUS arostopic echo
to get joystick feedback without a frontend
A website is composed of two elements:
- Server-side: We use
node
to run JS on a linux server.- The server is launched through the node script
scripts/index.js
- This sets up a simple http server with custom HTTP request handling.
- The server is launched through the node script
- Browser-side: browsers run JS code natively. The source files delivered to the browser are hosted in
app/
.- The browser looks for
index.html
, which contains explicit links to any other needed files. - Because we cannot import modules in the browser with the JS standard
require()
, these are typically included as*.min.js
library files. They are usually fetched from the internet, but can be predownloaded to use apps locally without an internet connection (seeapp/lib/
).
- The browser looks for
ROS melodic is not compatible with the nodejs
companion npm
in the base image ubuntu version, hence the node modules are copied directly into the image. To avoid matching npm
dependencies in the docker host to be able to install these, this repo includes the node_modules
folder. This is usually not done since these packages can be quite heavy, however our node dependencies weight just about 3.5MB.