Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
const globals = require("globals");
const globals = require('globals');

module.exports = [
{
languageOptions: {
"globals": {
'globals': {
...globals.browser,
...globals.node,
"bson": true
'bson': true
},
'parserOptions': {
'ecmaFeatures': {
'jsx': true
}
}
}
},
{
Expand All @@ -19,7 +24,6 @@ module.exports = [
eqeqeq: 2,
'wrap-iife': [2, 'any'],
'no-use-before-define': 0,
'new-cap': 2,
'no-caller': 2,
'dot-notation': 0,
'no-undef': 2,
Expand All @@ -30,6 +34,6 @@ module.exports = [
'no-proto': 2,
'linebreak-style': 2
},
files: ['Gruntfile.js', 'src/**/*.js']
files: ['**/*.{js,jsx,cjs}']
}
];
2 changes: 1 addition & 1 deletion examples/node_simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ angular : {
}
});

console.log("Publishing cmd_vel");
console.log('Publishing cmd_vel');
cmdVel.publish(twist);
4 changes: 2 additions & 2 deletions examples/react-example/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logo from './logo.svg'
import './App.css'
import SendMessage from "./component_examples/example_functions"
import React from "react";
import SendMessage from './component_examples/example_functions'
import React from 'react';

function App() {
return (
Expand Down
4 changes: 2 additions & 2 deletions examples/react-example/src/App.test.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/react'
import App from './App'
import React from "react";
import { expect, test } from "vitest";
import React from 'react';
import { expect, test } from 'vitest';

test('renders learn react link', () => {
render(<App />)
Expand Down
26 changes: 13 additions & 13 deletions examples/react-example/src/component_examples/example_functions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useState } from 'react'
import ROSLIB from '../../../..'

function SendMessage() {
const [status, setStatus] = useState("Not connected")
const [status, setStatus] = useState('Not connected')
const [linear, setLinear] = useState({ x: 0, y: 0, z: 0 })
const [angular, setAngular] = useState({ x: 0, y: 0, z: 0 })
const ros = new ROSLIB.Ros({encoding: 'ascii'})

function convert(input){
if (input.charAt(0) === "-") {
if (input.charAt(0) === '-') {
let x = input.slice(0)
return parseInt(x)
} else {
Expand All @@ -17,7 +17,7 @@ function SendMessage() {
}

function connect() {
ros.connect("ws://localhost:9090")
ros.connect('ws://localhost:9090')
// won't let the user connect more than once
ros.on('error', function (error) {
console.log(error)
Expand All @@ -27,12 +27,12 @@ function SendMessage() {
// Find out exactly when we made a connection.
ros.on('connection', function () {
console.log('Connected!')
setStatus("Connected!")
setStatus('Connected!')
})

ros.on('close', function () {
console.log('Connection closed')
setStatus("Connection closed")
setStatus('Connection closed')
})
}

Expand All @@ -42,8 +42,8 @@ function SendMessage() {
}
const cmdVel = new ROSLIB.Topic({
ros: ros,
name: "pose_topic",
messageType: "geometry_msgs/Pose2D"
name: 'pose_topic',
messageType: 'geometry_msgs/Pose2D'
})

const data = new ROSLIB.Message({
Expand All @@ -65,18 +65,18 @@ function SendMessage() {
<p>Send a message to turtle</p>
<p>Linear:</p>
<label>X</label>
<input name={"linear"} type={"number"} value={linear.x} onChange={(ev) => setLinear({...linear, x: convert(ev.target.value)})}/>
<input name={'linear'} type={'number'} value={linear.x} onChange={(ev) => setLinear({...linear, x: convert(ev.target.value)})}/>
<label>Y</label>
<input name={"linear"} type={"number"} value={linear.y} onChange={(ev) => setLinear({...linear, y: convert(ev.target.value)})}/>
<input name={'linear'} type={'number'} value={linear.y} onChange={(ev) => setLinear({...linear, y: convert(ev.target.value)})}/>
<label>Z</label>
<input name={"linear"} type={"number"} value={linear.z} onChange={(ev) => setLinear({...linear, z: convert(ev.target.value)})}/>
<input name={'linear'} type={'number'} value={linear.z} onChange={(ev) => setLinear({...linear, z: convert(ev.target.value)})}/>
<p>Angular:</p>
<label>X</label>
<input name={"angular"} type={"number"} value={angular.x} onChange={(ev) => setAngular({...angular, x: convert(ev.target.value)})}/>
<input name={'angular'} type={'number'} value={angular.x} onChange={(ev) => setAngular({...angular, x: convert(ev.target.value)})}/>
<label>Y</label>
<input name={"angular"} type={"number"} value={angular.y} onChange={(ev) => setAngular({...angular, y: convert(ev.target.value)})}/>
<input name={'angular'} type={'number'} value={angular.y} onChange={(ev) => setAngular({...angular, y: convert(ev.target.value)})}/>
<label>Z</label>
<input name={"angular"} type={"number"} value={angular.z} onChange={(ev) => setAngular({...angular, z: convert(ev.target.value)})}/>
<input name={'angular'} type={'number'} value={angular.z} onChange={(ev) => setAngular({...angular, z: convert(ev.target.value)})}/>
<br />
<button onClick={() => publish()}>Publish</button>
<br/>
Expand Down
4 changes: 2 additions & 2 deletions test/examples/check-topics.example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('../..');

var expectedTopics = [
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('Example topics are live', function() {
}));

it('unadvertise will end the topic (if it\s the last around)', () => new Promise((done) => {
console.log("Unadvertisement test. Wait for 15 seconds..");
console.log('Unadvertisement test. Wait for 15 seconds..');
setTimeout(function() {
ros.getTopics(function(result) {
expect(result.topics).not.to.contain('/some_test_topic');
Expand Down
2 changes: 1 addition & 1 deletion test/examples/fibonacci.example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('../..');

describe('Fibonacci Example', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/examples/params.examples.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('../..');

describe('Param setting', function() {
Expand Down
12 changes: 6 additions & 6 deletions test/examples/pubsub.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ describe('Topics Example', function() {
var topic1msg = messages1[0],
topic2msg = {};
example.subscribe(function(message) {
if (message.data === topic1msg.data) return;
if (message.data === topic1msg.data) {return;}
topic1msg = messages1[0];
expect(message).to.be.eql(messages2.shift());
if (messages1.length) example.publish(topic1msg);
else done();
if (messages1.length) {example.publish(topic1msg);}
else {done();}
});
example2.subscribe(function(message) {
if (message.data === topic2msg.data) return;
if (message.data === topic2msg.data) {return;}
topic2msg = messages2[0];
expect(message).to.be.eql(messages1.shift());
if (messages2.length) example2.publish(topic2msg);
else done();
if (messages2.length) {example2.publish(topic2msg);}
else {done();}
});
example.publish(topic1msg);
}));
Expand Down
2 changes: 1 addition & 1 deletion test/examples/tf.example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('../..');

describe('TF2 Republisher Example', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/examples/tf_service.example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('../..');

describe('TF2 Republisher Service Example', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/math-examples.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function clone(x) {
var y = {};
for (var prop in x) {
if (x.hasOwnProperty(prop)) {
y[prop] = typeof x[prop] === "object" ? clone(x[prop]) : x[prop];
y[prop] = typeof x[prop] === 'object' ? clone(x[prop]) : x[prop];
}
}
return y;
Expand Down
2 changes: 1 addition & 1 deletion test/quaternion.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('..');


Expand Down
2 changes: 1 addition & 1 deletion test/tfclient.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('..');

describe('TFClient', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/transform.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect } from 'vitest';
var ROSLIB = require('..');

describe('Transform', function() {
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defineConfig} from "vitest/config";
import {defineConfig} from 'vitest/config';

export default defineConfig({
test: {
Expand Down