Getting started (for javascript dummies) - ROS 2 humble, Ubuntu 22 #812
Replies: 1 comment 2 replies
-
Thanks for posting this!
Yeah, the examples are very very outdated. I did my best to keep them functional when I did a bunch of modernization of this codebase, but I frankly didn't invest any time into modernizing them.
Which are you talking about?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm a ROS/C++ developer using roslibjs to inspect the state of my autonomous system. I've written less than 200 lines of javascript in my life. Here's how I got started with this library (open to edits).
Assumptions
First off, some assumptions:
node
,npm
,pnpm
, or this library installedhumble
Install
Create a workspace (perhaps another package in your standard ros
src
folder) and enter into itUse pnpm to install roslibjs
^ I believe this is what created the
package.json
file.Amend the
package.json
file to add"type": "module"
Minimal setup
Create a folder, anywhere, with two files.
roslib_echo.js
In another terminal, publish a header that keeps incrementing the time so we can see it change.
ros2 topic pub /my_topic std_msgs/msg/Header "{ stamp: now }"
In another terminal, run your javascript app.
Expect the following logs for
roslib_echo.js
And, for rosbridge
Now, time to pipe the data in to
cesium.js
to see where my airplane is in the world!Gotchas
Next up
I want to figure out how to embed this javascript in html that also is part of my cesium app.
Beta Was this translation helpful? Give feedback.
All reactions