NodeConfig.java
Go to the documentation of this file.
00001 package org.rosbuilding.common;
00002 
00003 import org.ros.dynamic_reconfigure.server.BaseConfig;
00004 import org.ros.node.ConnectedNode;
00005 
00006 public abstract class NodeConfig extends BaseConfig {
00007 
00008     public static final String RATE = "rate";
00009 
00010     protected final ConnectedNode connectedNode;
00011 
00012     // Parameters
00013     private String prefix;
00014     private String fixedFrame;
00015     private int rate;
00016     private String mac;
00017 
00025     protected NodeConfig(ConnectedNode connectedNode,
00026             String defaultPrefix, String defaultFixedFrame, int defaultRate) {
00027         super(connectedNode);
00028 
00029         this.connectedNode = connectedNode;
00030         this.addField(RATE, "int", 0, "rate processus", 1, 0, 200);
00031 
00032         this.prefix = defaultPrefix;
00033         this.fixedFrame = defaultFixedFrame;
00034         this.rate = defaultRate;
00035     }
00036 
00037     protected void loadParameters() {
00038         //this.logI("Load parameters.");
00039 
00040         this.prefix = String.format("/%s/", this.connectedNode.getParameterTree()
00041                 .getString("~tf_prefix", this.prefix));
00042         this.fixedFrame = this.connectedNode.getParameterTree()
00043                 .getString("~fixed_frame", this.fixedFrame);
00044         this.rate = this.connectedNode.getParameterTree()
00045                 .getInteger("~" + RATE, this.rate);
00046         this.mac = this.connectedNode.getParameterTree()
00047                 .getString("~mac", "00:00:00:00:00:00");
00048 
00049         if (this.rate <= 0) {
00050             this.rate = 1;
00051         }
00052     }
00053 
00054     public String getPrefix() {
00055         return this.prefix;
00056     }
00057 
00058     public void setPrefix(String prefix) {
00059         this.prefix = prefix;
00060     }
00061 
00062     public String getFixedFrame() {
00063         return this.fixedFrame;
00064     }
00065 
00066     public void setFixedFrame(String fixedFrame) {
00067         this.fixedFrame = fixedFrame;
00068     }
00069 
00070     public int getRate() {
00071         return this.rate;
00072     }
00073 
00074     public void setRate(int rate) {
00075         this.rate = rate;
00076     }
00077 
00078     public String getMac() {
00079         return this.mac;
00080     }
00081 
00082     public void setMac(String mac) {
00083         this.mac = mac;
00084     }
00085 }


smarthome_common_driver
Author(s): Mickael Gaillard , Erwan Le Huitouze
autogenerated on Sat Jun 8 2019 19:35:17