Skip to content
Snippets Groups Projects
Commit 5a2cdcb0 authored by Arne's avatar Arne
Browse files

adjusted autogenerated code to match actionlib defaults

parent d91274e7
No related branches found
No related tags found
No related merge requests found
...@@ -24,9 +24,12 @@ import org.ros.exception.RosMessageRuntimeException; ...@@ -24,9 +24,12 @@ import org.ros.exception.RosMessageRuntimeException;
import org.ros.internal.message.definition.MessageDefinitionProviderChain; import org.ros.internal.message.definition.MessageDefinitionProviderChain;
import org.ros.internal.message.definition.MessageDefinitionTupleParser; import org.ros.internal.message.definition.MessageDefinitionTupleParser;
import org.ros.internal.message.action.ActionDefinitionFileProvider; import org.ros.internal.message.action.ActionDefinitionFileProvider;
import org.ros.internal.message.action.ActionGoalGenerationTemplate; import org.ros.internal.message.action.ActionGenerationTemplateActionGoal;
import org.ros.internal.message.action.ActionFeedbackGenerationTemplate; import org.ros.internal.message.action.ActionGenerationTemplateActionResult;
import org.ros.internal.message.action.ActionResultGenerationTemplate; import org.ros.internal.message.action.ActionGenerationTemplateActionFeedback;
import org.ros.internal.message.action.ActionGenerationTemplateGoal;
import org.ros.internal.message.action.ActionGenerationTemplateResult;
import org.ros.internal.message.action.ActionGenerationTemplateFeedback;
import org.ros.internal.message.service.ServiceDefinitionFileProvider; import org.ros.internal.message.service.ServiceDefinitionFileProvider;
import org.ros.internal.message.topic.TopicDefinitionFileProvider; import org.ros.internal.message.topic.TopicDefinitionFileProvider;
import org.ros.message.MessageDeclaration; import org.ros.message.MessageDeclaration;
...@@ -49,9 +52,14 @@ public class GenerateInterfaces { ...@@ -49,9 +52,14 @@ public class GenerateInterfaces {
private final ActionDefinitionFileProvider actionDefinitionFileProvider; private final ActionDefinitionFileProvider actionDefinitionFileProvider;
private final MessageDefinitionProviderChain messageDefinitionProviderChain; private final MessageDefinitionProviderChain messageDefinitionProviderChain;
private final MessageFactory messageFactory; private final MessageFactory messageFactory;
private final ActionGoalGenerationTemplate actionGoalGenerationTemplate = new ActionGoalGenerationTemplate();
private final ActionFeedbackGenerationTemplate actionFeedbackGenerationTemplate = new ActionFeedbackGenerationTemplate(); private final MessageGenerationTemplate actionGenerationTemplateGoal = new ActionGenerationTemplateGoal();
private final ActionResultGenerationTemplate actionResultGenerationTemplate = new ActionResultGenerationTemplate(); private final MessageGenerationTemplate actionGenerationTemplateResult = new ActionGenerationTemplateResult();
private final MessageGenerationTemplate actionGenerationTemplateFeedback = new ActionGenerationTemplateFeedback();
private final MessageGenerationTemplate actionGenerationTemplateActionGoal = new ActionGenerationTemplateActionGoal();
private final MessageGenerationTemplate actionGenerationTemplateActionResult = new ActionGenerationTemplateActionResult();
private final MessageGenerationTemplate actionGenerationTemplateActionFeedback = new ActionGenerationTemplateActionFeedback();
static private final String ROS_PACKAGE_PATH = "ROS_PACKAGE_PATH"; static private final String ROS_PACKAGE_PATH = "ROS_PACKAGE_PATH";
...@@ -162,20 +170,37 @@ public class GenerateInterfaces { ...@@ -162,20 +170,37 @@ public class GenerateInterfaces {
MessageDeclaration goalDeclaration = MessageDeclaration.of( MessageDeclaration goalDeclaration = MessageDeclaration.of(
actionType.getType() + "Goal", actionType.getType() + "Goal",
actionGoalGenerationTemplate.applyTemplate(goalResultAndFeedback.get(0)) actionGenerationTemplateGoal.applyTemplate(goalResultAndFeedback.get(0))
); );
MessageDeclaration resultDeclaration = MessageDeclaration.of( MessageDeclaration resultDeclaration = MessageDeclaration.of(
actionType.getType() + "Result", actionType.getType() + "Result",
actionResultGenerationTemplate.applyTemplate(goalResultAndFeedback.get(1)) actionGenerationTemplateResult.applyTemplate(goalResultAndFeedback.get(1))
); );
MessageDeclaration feedbackDeclaration = MessageDeclaration.of( MessageDeclaration feedbackDeclaration = MessageDeclaration.of(
actionType.getType() + "Feedback", actionType.getType() + "Feedback",
actionFeedbackGenerationTemplate.applyTemplate(goalResultAndFeedback.get(2)) actionGenerationTemplateFeedback.applyTemplate(goalResultAndFeedback.get(2))
);
MessageDeclaration actionGoalDeclaration = MessageDeclaration.of(
actionType.getType() + "ActionGoal",
actionGenerationTemplateActionGoal.applyTemplate(actionType.getType())
);
MessageDeclaration actionResultDeclaration = MessageDeclaration.of(
actionType.getType() + "ActionResult",
actionGenerationTemplateActionResult.applyTemplate(actionType.getType())
);
MessageDeclaration actionFeedbackDeclaration = MessageDeclaration.of(
actionType.getType() + "ActionFeedback",
actionGenerationTemplateActionFeedback.applyTemplate(actionType.getType())
); );
writeInterface(goalDeclaration, outputDirectory, true); writeInterface(goalDeclaration, outputDirectory, true);
writeInterface(resultDeclaration, outputDirectory, true); writeInterface(resultDeclaration, outputDirectory, true);
writeInterface(feedbackDeclaration, outputDirectory, true); writeInterface(feedbackDeclaration, outputDirectory, true);
writeInterface(actionGoalDeclaration, outputDirectory, true);
writeInterface(actionResultDeclaration, outputDirectory, true);
writeInterface(actionFeedbackDeclaration, outputDirectory, true);
} }
} }
......
/*
* Copyright (C) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.ros.internal.message.action;
import org.ros.internal.message.MessageGenerationTemplate;
/**
* @author arne.peters@tum.de (Arne Peters)
*/
public class ActionGenerationTemplateActionFeedback implements MessageGenerationTemplate {
/**
* @return returns this {@link Message} as a {@link RawMessage}
*/
public String applyTemplate(String messageSource) {
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
"\n" +
"Header header\n" +
"actionlib_msgs/GoalStatus status\n" +
messageSource + "Feedback feedback";
}
}
...@@ -16,10 +16,12 @@ ...@@ -16,10 +16,12 @@
package org.ros.internal.message.action; package org.ros.internal.message.action;
import org.ros.internal.message.MessageGenerationTemplate;
/** /**
* @author arne.peters@tum.de (Arne Peters) * @author arne.peters@tum.de (Arne Peters)
*/ */
public class ActionGoalGenerationTemplate { public class ActionGenerationTemplateActionGoal implements MessageGenerationTemplate {
/** /**
* @return returns this {@link Message} as a {@link RawMessage} * @return returns this {@link Message} as a {@link RawMessage}
...@@ -29,6 +31,6 @@ public class ActionGoalGenerationTemplate { ...@@ -29,6 +31,6 @@ public class ActionGoalGenerationTemplate {
"\n" + "\n" +
"Header header\n" + "Header header\n" +
"actionlib_msgs/GoalID goal_id\n" + "actionlib_msgs/GoalID goal_id\n" +
messageSource; messageSource + "Goal goal";
} }
} }
/*
* Copyright (C) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.ros.internal.message.action;
import org.ros.internal.message.MessageGenerationTemplate;
/**
* @author arne.peters@tum.de (Arne Peters)
*/
public class ActionGenerationTemplateActionResult implements MessageGenerationTemplate {
/**
* @return returns this {@link Message} as a {@link RawMessage}
*/
public String applyTemplate(String messageSource) {
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
"\n" +
"Header header\n" +
"actionlib_msgs/GoalStatus status\n" +
messageSource + "Result result";
}
}
/*
* Copyright (C) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.ros.internal.message.action;
import org.ros.internal.message.MessageGenerationTemplate;
/**
* @author arne.peters@tum.de (Arne Peters)
*/
public class ActionGenerationTemplateFeedback implements MessageGenerationTemplate {
/**
* @return returns this {@link Message} as a {@link RawMessage}
*/
public String applyTemplate(String messageSource) {
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
"#feedback definition\n" +
messageSource;
}
}
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
package org.ros.internal.message.action; package org.ros.internal.message.action;
import org.ros.internal.message.MessageGenerationTemplate;
/** /**
* @author arne.peters@tum.de (Arne Peters) * @author arne.peters@tum.de (Arne Peters)
*/ */
public class ActionFeedbackGenerationTemplate { public class ActionGenerationTemplateGoal implements MessageGenerationTemplate {
/** /**
* @return returns this {@link Message} as a {@link RawMessage} * @return returns this {@link Message} as a {@link RawMessage}
*/ */
public String applyTemplate(String messageSource) { public String applyTemplate(String messageSource) {
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" + return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
"\n" + "#goal definition" +
"Header header\n" +
"actionlib_msgs/GoalStatus status\n" +
messageSource; messageSource;
} }
} }
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
package org.ros.internal.message.action; package org.ros.internal.message.action;
import org.ros.internal.message.MessageGenerationTemplate;
/** /**
* @author arne.peters@tum.de (Arne Peters) * @author arne.peters@tum.de (Arne Peters)
*/ */
public class ActionResultGenerationTemplate { public class ActionGenerationTemplateResult implements MessageGenerationTemplate {
/** /**
* @return returns this {@link Message} as a {@link RawMessage} * @return returns this {@link Message} as a {@link RawMessage}
*/ */
public String applyTemplate(String messageSource) { public String applyTemplate(String messageSource) {
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" + return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" +
"\n" + "#result definition" +
"Header header\n" +
"actionlib_msgs/GoalStatus status\n" +
messageSource; messageSource;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment