Skip to content

Commit b9fd7dd

Browse files
authored
Remove groovyCompatibility flag (#1031)
1 parent ec1d959 commit b9fd7dd

File tree

4 files changed

+11
-90
lines changed

4 files changed

+11
-90
lines changed

examples/tf.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88
<script>
99
// Connecting to ROS
1010
// -----------------
11-
var ros = new ROSLIB.Ros({
12-
// set this to false to use the new service interface to
13-
// tf2_web_republisher. true is the default and means roslibjs
14-
// will use the action interface
15-
groovyCompatibility : true
16-
});
11+
var ros = new ROSLIB.Ros();
1712

1813
// If there is an error on the backend, an 'error' emit will be emitted.
1914
ros.on('error', function(error) {

src/core/Ros.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,25 @@ export default class Ros extends EventEmitter<
4949
isConnected = false;
5050
transportLibrary: "websocket" | RTCPeerConnection;
5151
transportOptions;
52-
groovyCompatibility: boolean;
5352
/**
5453
* @param [options]
5554
* @param [options.url] - The WebSocket URL for rosbridge. Can be specified later with `connect`.
56-
* @param [options.groovyCompatibility=true] - Don't use interfaces that changed after the last groovy release or rosbridge_suite and related tools.
5755
* @param [options.transportLibrary='websocket'] - 'websocket', or an RTCPeerConnection instance controlling how the connection is created in `connect`.
5856
* @param [options.transportOptions={}] - The options to use when creating a connection. Currently only used if `transportLibrary` is RTCPeerConnection.
5957
*/
6058
constructor({
6159
url,
6260
transportLibrary = "websocket",
6361
transportOptions = {},
64-
groovyCompatibility = true,
6562
}: {
6663
url?: string;
67-
groovyCompatibility?: boolean;
6864
transportLibrary?: "websocket" | RTCPeerConnection;
6965
transportOptions?: object;
7066
} = {}) {
7167
super();
7268

7369
this.transportLibrary = transportLibrary;
7470
this.transportOptions = transportOptions;
75-
this.groovyCompatibility = groovyCompatibility;
7671

7772
// begin by checking if a URL was given
7873
if (url) {

src/tf/TFClient.ts

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
import ActionClient from "../actionlib/ActionClient.js";
77
import Goal from "../actionlib/Goal.js";
88

9-
import Service from "../core/Service.js";
109
import Topic from "../core/Topic.js";
11-
import Ros from "../core/Ros.js";
1210
import { tf2_msgs } from "../types/tf2_msgs.js";
1311
import { tf2_web_republisher } from "../types/tf2_web_republisher.js";
1412

@@ -20,12 +18,7 @@ import BaseTFClient from "./BaseTFClient.js";
2018
export default class TFClient extends BaseTFClient {
2119
currentGoal: Goal<tf2_web_republisher.TFSubscriptionGoal> | false = false;
2220
currentTopic: Topic<tf2_msgs.TFMessage> | false = false;
23-
repubServiceName: string;
2421
actionClient: ActionClient<tf2_web_republisher.TFSubscriptionGoal>;
25-
serviceClient: Service<
26-
tf2_web_republisher.RepublishTFsRequest,
27-
tf2_web_republisher.RepublishTFsResponse
28-
>;
2922
#subscribeCB: ((tf: tf2_msgs.TFMessage) => void) | undefined = undefined;
3023
#isDisposed = false;
3124

@@ -40,26 +33,10 @@ export default class TFClient extends BaseTFClient {
4033
* to update the TF republisher's list of TFs.
4134
* @param [options.topicTimeout=2.0] - The timeout parameter for the TF republisher.
4235
* @param [options.serverName="/tf2_web_republisher"] - The name of the tf2_web_republisher server.
43-
* @param [options.repubServiceName="/republish_tfs"] - The name of the republish_tfs service (non groovy compatibility mode only).
4436
*/
45-
constructor({
46-
repubServiceName = "/republish_tfs",
47-
...options
48-
}: {
49-
ros: Ros;
50-
fixedFrame?: string;
51-
angularThres?: number;
52-
transThres?: number;
53-
rate?: number;
54-
updateDelay?: number;
55-
topicTimeout?: number;
56-
serverName?: string;
57-
repubServiceName?: string;
58-
}) {
37+
constructor(options: ConstructorParameters<typeof BaseTFClient>[0]) {
5938
super(options);
6039

61-
this.repubServiceName = repubServiceName;
62-
6340
// Create an Action Client
6441
this.actionClient = new ActionClient({
6542
ros: this.ros,
@@ -68,13 +45,6 @@ export default class TFClient extends BaseTFClient {
6845
omitStatus: true,
6946
omitResult: true,
7047
});
71-
72-
// Create a Service Client
73-
this.serviceClient = new Service({
74-
ros: this.ros,
75-
name: this.repubServiceName,
76-
serviceType: "tf2_web_republisher/RepublishTFs",
77-
});
7848
}
7949

8050
/**
@@ -90,32 +60,16 @@ export default class TFClient extends BaseTFClient {
9060
rate: this.rate,
9161
};
9262

93-
/*
94-
* if we're running in groovy compatibility mode (the default)
95-
* then use the action interface to tf2_web_republisher
96-
*/
97-
if (this.ros.groovyCompatibility) {
98-
if (this.currentGoal) {
99-
this.currentGoal.cancel();
100-
}
101-
this.currentGoal = new Goal<tf2_web_republisher.TFSubscriptionGoal>({
102-
actionClient: this.actionClient,
103-
goalMessage: goalMessage,
104-
});
105-
106-
this.currentGoal.on("feedback", this.processTFArray.bind(this));
107-
this.currentGoal.send();
108-
} else {
109-
/*
110-
* otherwise, use the service interface
111-
* The service interface has the same parameters as the action,
112-
* plus the timeout
113-
*/
114-
this.serviceClient.callService(
115-
{ ...goalMessage, timeout: this.topicTimeout },
116-
this.processResponse.bind(this),
117-
);
63+
if (this.currentGoal) {
64+
this.currentGoal.cancel();
11865
}
66+
this.currentGoal = new Goal<tf2_web_republisher.TFSubscriptionGoal>({
67+
actionClient: this.actionClient,
68+
goalMessage: goalMessage,
69+
});
70+
71+
this.currentGoal.on("feedback", this.processTFArray.bind(this));
72+
this.currentGoal.send();
11973

12074
this.republisherUpdateRequested = false;
12175
}

test/examples/tf_service.example.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,6 @@ describe.skipIf(process.env.ROS_DISTRO !== "noetic")(
77
"ROS 1 TF2 Republisher Service Example",
88
function () {
99
it("tf republisher", () =>
10-
new Promise<void>((done) => {
11-
const ros = new ROSLIB.Ros({
12-
// Use the service interface to tf2_web_republisher
13-
groovyCompatibility: false,
14-
});
15-
ros.connect("ws://localhost:9090");
16-
17-
const tfClient = new ROSLIB.TFClient({
18-
ros: ros,
19-
fixedFrame: "world",
20-
angularThres: 0.01,
21-
transThres: 0.01,
22-
});
23-
24-
// Subscribe to a turtle.
25-
tfClient.subscribe("turtle1", function (tf) {
26-
expect(tf.rotation).to.be.eql(new ROSLIB.Quaternion());
27-
expect(tf.translation).to.be.a.instanceof(ROSLIB.Vector3);
28-
done();
29-
});
30-
}));
31-
32-
it("tf republisher alternative syntax", () =>
3310
new Promise<void>((done) => {
3411
const ros = new ROSLIB.Ros({
3512
url: "ws://localhost:9090",

0 commit comments

Comments
 (0)