4 * Class Publisher provides methods for creating and working
5 * with the ORTE publisher.
7 * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
8 * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz)
9 * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
10 * @author dedication to Kj
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
25 import org.ocera.orte.*;
26 import org.ocera.orte.types.*;
29 public class RoboPublisher {
31 // load native library 'libjorte.so'
34 System.loadLibrary("jorte");
37 public static void main(String[] args)
41 System.out.println(":j: * ********************************************* *");
42 System.out.println(":j: * JORTE Publisher is starting.. *");
43 System.out.println(":j: * ********************************************* *");
45 // set publisher's parameters
46 NtpTime persistence = new NtpTime(3);
49 RoboEvents events = new RoboEvents();
52 * Create a new Application Domain for a Publisher.
53 * (Constructor without arguments creates the default Application Domain.)
55 // creates default app domain
56 //DomainApp appDomain = new DomainApp();
57 // creates user defined app domain
59 DomainApp appDomain = new DomainApp(ORTEConstant.ORTE_DEFAULT_DOMAIN,
60 DomainProp.defaultPropsCreate(),
63 if (appDomain == null)
65 System.out.println(":!j: cannot create default domain!");
69 // create a HelloMessage instance
70 RoboMsg hellomsg = new RoboMsg(appDomain,"motion_speed");
72 // set basic subscription properties
73 PublProp publProp = new PublProp(hellomsg.getTopic(),
78 System.out.println(":j: set publication properties..");
80 /* set verbosity mode - just uncomment the line bellow */
81 // JOrte.verbositySetOptions("ALL:10");
83 // create a publication
84 Publication pub = appDomain.createPublication(publProp,
88 System.out.println(":j!: publisher not created!");
91 System.out.println(":j: publisher created!");
92 System.out.println(":j: * ********************************************* *");
93 System.out.println(":j: start sending data:");
94 System.out.println(":j: * ********************************************* *");
99 System.out.println("<< data to send: " + hellomsg);
101 System.out.println(" ");