-
-
Save newcanopies/976387554fe2504e232b8e8efd18a42a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const express = require('express'); | |
const app = express(); | |
app.use(express.static('../examples/html')); | |
app.listen(3000); | |
console.log('The web server started on http://localhost:3000'); | |
const rclnodejs = require('rclnodejs'); | |
rclnodejs | |
.init() | |
.then(() => { | |
const node = rclnodejs.createNode('publisher_message_example_node'); | |
const publisher = node.createPublisher( | |
'geometry_msgs/msg/PoseStamped', | |
// 'PoseStamped' | |
'/test_topic' | |
); | |
let count = 0; | |
setInterval(function () { | |
publisher.publish({ | |
header: { | |
stamp: { | |
sec : 0, | |
nanosec : 100 | |
}, | |
frame_id : "map" | |
}, | |
pose: { | |
position: { | |
x : 0.0, | |
y : 0.0, | |
z : 0.0 | |
}, | |
orientation: { | |
x : 0.0, | |
y : 0.0, | |
z : 0.0, | |
w : 1.0 | |
} | |
} | |
}); | |
console.log(`Publish ${++count} messages.`); | |
}, 1000); | |
rclnodejs.spin(node); | |
}) | |
.catch((e) => { | |
console.log(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment