Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
npm install rosnodejs
const rosnodejs = require('rosnodejs');
rosnodejs.initNode('/my_node')
.then(() => {
// do stuff
});
const nh = rosnodejs.nh;
const sub = nh.subscribe('/chatter', 'std_msgs/String', (msg) => {
console.log('Got msg on chatter: %j', msg);
});
const pub = nh.advertise('/chatter', 'std_msgs/String');
pub.publish({ data: "hi" });
const nh = rosnodejs.nh;
const sub = nh.subscribe('/chatter', 'std_msgs/String', (msg) => {
console.log('Got msg on chatter: %j', msg);
}, {
transports: ["TCPROS", "UDPROS"], // specify transports, default ["TCPROS"]
dgramSize: 1500 // optional: datagram packet size, default: 1500 bytes
});
const pub = nh.advertise('/chatter', 'std_msgs/String');
pub.publish({ data: "hi" });
const service = nh.advertiseService('/add_two_ints', 'beginner_tutorials/AddTwoInts', (req, res) => {
res.sum = req.a + req.b;
return true;
});
const client = nh.serviceClient('/add_two_ints', 'beginner_tutorials/AddTwoInts');
client.call({a: 1, b: 2});
nh.setParam('val', 2);
nh.getParam('val')
.then((val) => {
// do stuff
});
Messages can be generated in a number of ways depending on the versions of ROS and Node.js you're using.
$ catkin_make
OR
$ catkin build
loadAllPackages()
- One-time "build" call available through rosnodejs
for versions of ROS before Kinetic and Node.js v6+. Should be called separately and in advance of processes attempting to use messages.const rosnodejs = require('rosnodejs');
rosnodejs.loadAllPackages();
const rosnodejs = require('rosnodejs');
rosnodejs.initNode('my_node', { onTheFly: true }).then(() => {
const stdMsgs = rosnodejs.require('std_msgs');
...
}
Pre-Kinetic | Kinetic & Later | |
---|---|---|
Node.js >= v6 | loadAllPackages() , on the fly | catkin, loadAllPackages() , on the fly |
Node.js < v6 | on the fly | on the fly |
const sensorMsgs = rosnodejs.require('sensor_msgs');
const image = new sensorMsgs.msg.Image();
const temperature = new sensorMsgs.msg.Temperature({ temperature: 32 });
const SetCameraInfo = sensorMsgs.srv.SetCameraInfo;
const setRequest = new SetCameraInfo.Request();
// messages can be used when advertising/subscribing
const nh = rosnodejs.nh;
const StringMsg = rosnodejs.require('std_msgs').msg.String;
const sub = nh.subscribe('/chatter', StringMsg, (msg) => { ... });
const pub = nh.advertise('/chatter', StringMsg);
const AddTwoInts = rosnodejs.require('beginner_tutorials').srv.AddTwoInts;
const service = nh.advertiseService('/add_two_ints', AddTwoInts, (req, res) => { ... });
const client = nh.serviceClient('/add_two_ints', AddTwoInts);
const nh = rosnodejs.nh;
const as = new rosnodejs.ActionServer({
nh,
type: 'turtle_actionlib/Shape',
actionServer: '/turtle_shape'
});
as.on('goal', function (goal) {
goal.setAccepted();
});
as.start();
const ac = new rosnodejs.ActionClient({
nh,
type: 'turtle_actionlib/Shape',
actionServer:'/turtle_shape'
});
ac.sendGoal({edges: 3, radius: 1});
Start:
roscore
rosrun turtlesim turtlesim_node
rosrun turtle_actionlib shape_server
Then run
node src/examples/turtle.js
or, if you are running an older version of node:
npm run compile
node dist/examples/turtle.js
Checkout rosnodejs_examples
for a more catkin-inspired take on using rosnodejs
.
rosnodejs
was inspired by other work that you can learn more about here
FAQs
Native ROS for nodejs
The npm package rosnodejs receives a total of 958 weekly downloads. As such, rosnodejs popularity was classified as not popular.
We found that rosnodejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.