Skip to content

Commit 5a2cdcb

Browse files
committed
adjusted autogenerated code to match actionlib defaults
1 parent d91274e commit 5a2cdcb

7 files changed

+152
-19
lines changed

message_generation/src/main/java/org/ros/internal/message/GenerateInterfaces.java

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
import org.ros.internal.message.definition.MessageDefinitionProviderChain;
2525
import org.ros.internal.message.definition.MessageDefinitionTupleParser;
2626
import org.ros.internal.message.action.ActionDefinitionFileProvider;
27-
import org.ros.internal.message.action.ActionGoalGenerationTemplate;
28-
import org.ros.internal.message.action.ActionFeedbackGenerationTemplate;
29-
import org.ros.internal.message.action.ActionResultGenerationTemplate;
27+
import org.ros.internal.message.action.ActionGenerationTemplateActionGoal;
28+
import org.ros.internal.message.action.ActionGenerationTemplateActionResult;
29+
import org.ros.internal.message.action.ActionGenerationTemplateActionFeedback;
30+
import org.ros.internal.message.action.ActionGenerationTemplateGoal;
31+
import org.ros.internal.message.action.ActionGenerationTemplateResult;
32+
import org.ros.internal.message.action.ActionGenerationTemplateFeedback;
3033
import org.ros.internal.message.service.ServiceDefinitionFileProvider;
3134
import org.ros.internal.message.topic.TopicDefinitionFileProvider;
3235
import org.ros.message.MessageDeclaration;
@@ -49,9 +52,14 @@ public class GenerateInterfaces {
4952
private final ActionDefinitionFileProvider actionDefinitionFileProvider;
5053
private final MessageDefinitionProviderChain messageDefinitionProviderChain;
5154
private final MessageFactory messageFactory;
52-
private final ActionGoalGenerationTemplate actionGoalGenerationTemplate = new ActionGoalGenerationTemplate();
53-
private final ActionFeedbackGenerationTemplate actionFeedbackGenerationTemplate = new ActionFeedbackGenerationTemplate();
54-
private final ActionResultGenerationTemplate actionResultGenerationTemplate = new ActionResultGenerationTemplate();
55+
56+
private final MessageGenerationTemplate actionGenerationTemplateGoal = new ActionGenerationTemplateGoal();
57+
private final MessageGenerationTemplate actionGenerationTemplateResult = new ActionGenerationTemplateResult();
58+
private final MessageGenerationTemplate actionGenerationTemplateFeedback = new ActionGenerationTemplateFeedback();
59+
60+
private final MessageGenerationTemplate actionGenerationTemplateActionGoal = new ActionGenerationTemplateActionGoal();
61+
private final MessageGenerationTemplate actionGenerationTemplateActionResult = new ActionGenerationTemplateActionResult();
62+
private final MessageGenerationTemplate actionGenerationTemplateActionFeedback = new ActionGenerationTemplateActionFeedback();
5563

5664
static private final String ROS_PACKAGE_PATH = "ROS_PACKAGE_PATH";
5765

@@ -162,20 +170,37 @@ private void writeActionInterfaces(File outputDirectory, Collection<String> pack
162170

163171
MessageDeclaration goalDeclaration = MessageDeclaration.of(
164172
actionType.getType() + "Goal",
165-
actionGoalGenerationTemplate.applyTemplate(goalResultAndFeedback.get(0))
173+
actionGenerationTemplateGoal.applyTemplate(goalResultAndFeedback.get(0))
166174
);
167175
MessageDeclaration resultDeclaration = MessageDeclaration.of(
168176
actionType.getType() + "Result",
169-
actionResultGenerationTemplate.applyTemplate(goalResultAndFeedback.get(1))
177+
actionGenerationTemplateResult.applyTemplate(goalResultAndFeedback.get(1))
170178
);
171179
MessageDeclaration feedbackDeclaration = MessageDeclaration.of(
172180
actionType.getType() + "Feedback",
173-
actionFeedbackGenerationTemplate.applyTemplate(goalResultAndFeedback.get(2))
181+
actionGenerationTemplateFeedback.applyTemplate(goalResultAndFeedback.get(2))
182+
);
183+
184+
MessageDeclaration actionGoalDeclaration = MessageDeclaration.of(
185+
actionType.getType() + "ActionGoal",
186+
actionGenerationTemplateActionGoal.applyTemplate(actionType.getType())
187+
);
188+
MessageDeclaration actionResultDeclaration = MessageDeclaration.of(
189+
actionType.getType() + "ActionResult",
190+
actionGenerationTemplateActionResult.applyTemplate(actionType.getType())
191+
);
192+
MessageDeclaration actionFeedbackDeclaration = MessageDeclaration.of(
193+
actionType.getType() + "ActionFeedback",
194+
actionGenerationTemplateActionFeedback.applyTemplate(actionType.getType())
174195
);
175196

176197
writeInterface(goalDeclaration, outputDirectory, true);
177198
writeInterface(resultDeclaration, outputDirectory, true);
178199
writeInterface(feedbackDeclaration, outputDirectory, true);
200+
201+
writeInterface(actionGoalDeclaration, outputDirectory, true);
202+
writeInterface(actionResultDeclaration, outputDirectory, true);
203+
writeInterface(actionFeedbackDeclaration, outputDirectory, true);
179204
}
180205
}
181206

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (C) 2012 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package org.ros.internal.message.action;
18+
19+
import org.ros.internal.message.MessageGenerationTemplate;
20+
21+
/**
22+
* @author arne.peters@tum.de (Arne Peters)
23+
*/
24+
public class ActionGenerationTemplateActionFeedback implements MessageGenerationTemplate {
25+
26+
/**
27+
* @return returns this {@link Message} as a {@link RawMessage}
28+
*/
29+
public String applyTemplate(String messageSource) {
30+
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
31+
"\n" +
32+
"Header header\n" +
33+
"actionlib_msgs/GoalStatus status\n" +
34+
messageSource + "Feedback feedback";
35+
}
36+
}

message_generation/src/main/java/org/ros/internal/message/action/ActionGoalGenerationTemplate.java renamed to message_generation/src/main/java/org/ros/internal/message/action/ActionGenerationTemplateActionGoal.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616

1717
package org.ros.internal.message.action;
1818

19+
import org.ros.internal.message.MessageGenerationTemplate;
20+
1921
/**
2022
* @author arne.peters@tum.de (Arne Peters)
2123
*/
22-
public class ActionGoalGenerationTemplate {
24+
public class ActionGenerationTemplateActionGoal implements MessageGenerationTemplate {
2325

2426
/**
2527
* @return returns this {@link Message} as a {@link RawMessage}
@@ -29,6 +31,6 @@ public String applyTemplate(String messageSource) {
2931
"\n" +
3032
"Header header\n" +
3133
"actionlib_msgs/GoalID goal_id\n" +
32-
messageSource;
34+
messageSource + "Goal goal";
3335
}
3436
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (C) 2012 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package org.ros.internal.message.action;
18+
19+
import org.ros.internal.message.MessageGenerationTemplate;
20+
21+
/**
22+
* @author arne.peters@tum.de (Arne Peters)
23+
*/
24+
public class ActionGenerationTemplateActionResult implements MessageGenerationTemplate {
25+
26+
/**
27+
* @return returns this {@link Message} as a {@link RawMessage}
28+
*/
29+
public String applyTemplate(String messageSource) {
30+
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
31+
"\n" +
32+
"Header header\n" +
33+
"actionlib_msgs/GoalStatus status\n" +
34+
messageSource + "Result result";
35+
}
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (C) 2012 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package org.ros.internal.message.action;
18+
19+
import org.ros.internal.message.MessageGenerationTemplate;
20+
21+
/**
22+
* @author arne.peters@tum.de (Arne Peters)
23+
*/
24+
public class ActionGenerationTemplateFeedback implements MessageGenerationTemplate {
25+
26+
/**
27+
* @return returns this {@link Message} as a {@link RawMessage}
28+
*/
29+
public String applyTemplate(String messageSource) {
30+
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
31+
"#feedback definition\n" +
32+
messageSource;
33+
}
34+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
package org.ros.internal.message.action;
1818

19+
import org.ros.internal.message.MessageGenerationTemplate;
20+
1921
/**
2022
* @author arne.peters@tum.de (Arne Peters)
2123
*/
22-
public class ActionFeedbackGenerationTemplate {
24+
public class ActionGenerationTemplateGoal implements MessageGenerationTemplate {
2325

2426
/**
2527
* @return returns this {@link Message} as a {@link RawMessage}
2628
*/
2729
public String applyTemplate(String messageSource) {
2830
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
29-
"\n" +
30-
"Header header\n" +
31-
"actionlib_msgs/GoalStatus status\n" +
31+
"#goal definition" +
3232
messageSource;
3333
}
3434
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
package org.ros.internal.message.action;
1818

19+
import org.ros.internal.message.MessageGenerationTemplate;
20+
1921
/**
2022
* @author arne.peters@tum.de (Arne Peters)
2123
*/
22-
public class ActionResultGenerationTemplate {
24+
public class ActionGenerationTemplateResult implements MessageGenerationTemplate {
2325

2426
/**
2527
* @return returns this {@link Message} as a {@link RawMessage}
2628
*/
2729
public String applyTemplate(String messageSource) {
2830
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
29-
"\n" +
30-
"Header header\n" +
31-
"actionlib_msgs/GoalStatus status\n" +
31+
"#result definition" +
3232
messageSource;
3333
}
3434
}

0 commit comments

Comments
 (0)