KY-RTI分布仿真技术:第六章 Java程序设计

2023-05-16

第六章 Java程序设计

       本章讲述了如何基于Java设计聊天程序和时间管理程序,两个程序都是控制台程序。聊天程序相当于4.3节的GNU C++聊天程序;时间管理程序相当于4.4节的GNU C++程序。对于不同的程序设计语言而言,基于HLA/RTI设计仿真应用的方法都差不多,其关键在于RTI软件能否支持相应程序设计语言的开发,用户只需要关心一下调用接口即可,通过调用接口可以设计形式多样的程序。与C++调用接口的一个显著区别在于句柄和时间的表示,Java中的各种句柄全部用int表示,各类时间则用double表示。

6.1 聊天程序

6.1.1需求分析

       本项目需要实现一个类似微信群或者QQ群聊天功能的Java程序,每个人发送的消息都能够被群里的其他人看到。

6.1.2项目设计

       每条聊天信息应包含2个内容:聊天者昵称、聊天的一句话,这样接收者就会知道是谁在发言。“聊天者昵称”用name表示,“聊天的一句话”用sentence表示,两个都是字符串类型。因为HLA是面向对象的,发送的数据要么采用对象类,要么采用交互类。本项目可采用交互类,将name和sentence封装到一个名叫“chat”的交互类中,如下列伪代码所示。

class chat {           //交互类

       string  name;     //参数

       string  sentence; //参数

}

       下面采用KY-OMT创建fed文件,相应的chat.fed文件已经在3.3.3中创建完成,将该文件保存到KY-RTI的bin目录。

       本项目对时间没有特别要求,不需要采用HLA时间管理机制。在采用Java语言开发时,不要使用tick服务,否则会报一个警告。

6.1.3代码设计

       该程序由3个源文件组成:GlobalVariables.java、Chat.java、HwFederateAmbassador.java。GlobalVariables.java定义了其他两个文件需要用到的公用变量;Chat.java调用RTI服务访问RTI;HwFederateAmbassador.java接收RTI回调服务。

       GlobalVariables.java定义了可由Chat.java、HwFederateAmbassador.java共享使用的静态变量;因为Java不支持C++的全局变量概念,这里的静态变量就相当于C++的全局变量。

                                      表6.1  Java聊天示例:GlobalVariables.java

  1. public class GlobalVariables
  2. {
  3.     public static int        hChatClass;
  4.     public static int        hChatName;
  5.     public static int        hChatSentence;
  6. }

       Chat.java代码说明:

21-25行:创建联邦执行;

27-33行:加入联邦执行;

36-38行:获取交互类及其参数句柄;

41行:公布交互类,只有公布之后才能够向RTI发送交互;

43行:订购交互类,只有订购之后才能够从RTI收到其他人的聊天内容;

46-59行:循环操作,每次输入一句话,并调用sendInteraction服务发送给RTI;当用户输入“exit”时则退出执行;

65行:该行为注释行,表示仿真成员在结束时不需要调用'resignFederationExecution'和 'destroyFederationExecution'服务,RTI服务器会自动执行这两个服务。

                                      表6.2  Java聊天示例:Chat.java

  1. import MID.*;
  2. import RTI.*;
  3. public class Chat
  4. {
  5.     public static void main(String[] args) {
  6.         String federationName = "chat";
  7.         String federateName = System.console().readLine("Please input your name: ");
  8.         HwFederateAmbassador fed;
  9.         RTI_RTIambassador rti;
  10.         try {
  11.             fed = new HwFederateAmbassador();
  12.             rti = new RTI_RTIambassador();
  13.         } catch(Exception ex) {
  14.             ex.printStackTrace();
  15.             return;
  16.         }
  17.         try {
  18.             rti.createFederationExecution(federationName, "chat.fed");
  19.         } catch(Exception ex) {
  20.             // According to the HLA standard, only the first federate can call createFederationExecution successfully. Don't return.
  21.         }
  22.         try {
  23.             int federateHandle = rti.joinFederationExecution(federateName, federationName, fed);
  24.             //System.out.println("my federate handle is "+federateHandle);
  25.         } catch(Exception ex) {
  26.             ex.printStackTrace();
  27.             return;
  28.         }
  29.         try {
  30.             GlobalVariables.hChatClass = rti.getInteractionClassHandle("chat");
  31.             GlobalVariables.hChatName = rti.getParameterHandle("name", GlobalVariables.hChatClass);
  32.             GlobalVariables.hChatSentence = rti.getParameterHandle("sentence", GlobalVariables.hChatClass);
  33.             //如果向外发送,则需要公布
  34.             rti.publishInteractionClass(GlobalVariables.hChatClass);
  35.             //如果需要接收,则必须订购
  36.             rti.subscribeInteractionClass(GlobalVariables.hChatClass);
  37.             String szSentence = "";
  38.             while (!szSentence.equals("exit")) {
  39.                 szSentence = System.console().readLine("Please input a sentence: ");
  40.                 HandleValuePair[] theParameters = new HandleValuePair[2];
  41.                 theParameters[0] = new HandleValuePair();
  42.                 theParameters[0].aHandle = GlobalVariables.hChatName;
  43.                 theParameters[0].aValue = federateName; //int -> String
  44.                 theParameters[1] = new HandleValuePair();
  45.                 theParameters[1].aHandle = GlobalVariables.hChatSentence;
  46.                 theParameters[1].aValue = szSentence; //int -> String
  47.                 rti.sendInteraction(GlobalVariables.hChatClass, theParameters, "");
  48.             }
  49.         } catch (Exception ex) {
  50.             ex.printStackTrace();
  51.             return;
  52.         }
  53.         //After the program exits, the RTI will automatically calls 'resignFederationExecution' and 'destroyFederationExecution'.
  54.     }
  55. }

       HwFederateAmbassador.java代码说明:

5-8行:由于不处理时间参数,因此如果接收到这种类型的receiveInteraction交互,则直接调用不带时间参数的服务来统一处理;

10-28行:处理接收到的聊天信息,将其简单输出即可。

                                      表6.3  Java聊天示例:HwFederateAmbassador.java

  1. import MID.*;
  2. public class HwFederateAmbassador extends RTIFederateAmbassador
  3. {
  4.     public final void receiveInteraction(int theInteraction, MID.HandleValuePair[] theParameters, double theTime, String theTag, MID.EventRetractionHandle theHandle) {
  5.         //call the next service.
  6.         receiveInteraction(theInteraction, theParameters, theTag);
  7.     }
  8.     public final void receiveInteraction(int theInteraction, MID.HandleValuePair[] theParameters, String theTag) {
  9.         String name = new String();     //name of sender
  10.         String sentence = new String(); //sentence of sender
  11.         for ( int i = 0; i < theParameters.length; i++ ) {
  12.             if (theParameters[i].aHandle == GlobalVariables.hChatName) {
  13.                 name = theParameters[i].aValue;
  14.             } else if (theParameters[i].aHandle == GlobalVariables.hChatSentence) {
  15.                 sentence = theParameters[i].aValue;
  16.             } else {
  17.                 System.out.println("Receive wrong parameter handle.");
  18.             }
  19.         }
  20.         System.out.println();
  21.         System.out.println(name + ": " + sentence);
  22.     }
  23. }

6.1.4编译运行

6.1.4.1编译

       编译Java程序,只要将kyrti.jar文件加入到CLASSPATH环境变量,或者在编译时作为命令参数添加。

       (1)如果在CLASSPATH环境变量中已经设置,则编译命令如下。

       javac  *.java

       (2)在编译时作为参数添加,则编译命令如下。

       javac  -classpath .;C:\KY-RTI\jar\ky-rti.jar  *.java                                       #Windows

       javac -classpath .:/home/lbq/RTI-1.3NGv6/Linux-x86_64-opt-mt/jar/ky-rti.jar  *.java      #Linux

6.1.4.2测试运行

       测试项目:在银河麒麟操作系统上运行2个Java仿真成员,测试KY-RTI通信功能。

       测试步骤:

       第1步:启动KY-RTI。注意,KY-RTI的IP地址和端口号要与RTI.rid一致。如果没有RTI.rid文件,则程序在运行时会自动生成该文件。Java程序不关注tick开关。

       第2步:如图6.1和图6.2所示,开启两个终端,运行2个仿真成员,开始对话。运行程序命令:

       java  Chat

       测试结果表明:Java仿真成员的聊天功能正常,KY-RTI支持中英文传输。

                                      图6.1 Java聊天者1

                                      图6.1 Java聊天者2

6.2 时间管理程序

6.2.1需求分析

       本仿真项目的名称为“TimeManagementExample”,名称规定了不是“TimeManagementExample”的程序不属于本项目。对HLA/RTI程序来说,联邦名称为“TimeManagementExample”,不是该名字的仿真成员不属于本项目。

       每个仿真成员拥有3架飞机,但其中只有1架飞机会起飞,飞机的x、y坐标为随机数(不考虑合理性),飞机会每隔1秒发布自己的位置信息。

6.2.2项目设计

       飞机每隔1秒发布自己的位置信息,意味着该仿真应采用时间管理服务,仿真步长为1。

       飞机发送的是自己的x、y二维态势信息,用一个对象类plane来封装,两个属性为xPos和yPos,类型为整型;但不管什么类型,在RTI中都是作为字符串来传送。如下列代码所示。

class plane {         //对象类

       int  xPos;      //属性

       int  yPos;      //属性

}

       下面采用KY-OMT创建fed文件,相应的tracer.fed文件已经在3.3.2中创建完成,将该文件保存到KY-RTI的bin目录。

6.2.3代码设计

       该程序由3个源文件组成:GlobalVariables.java、TimeManagement.java、HwFederateAmbassador.java。GlobalVariables.java定义了其他两个文件需要用到的公用变量;Chat.java调用RTI服务访问RTI;HwFederateAmbassador.java接收RTI回调服务。

       GlobalVariables.java定义了可由TimeManagement.java、HwFederateAmbassador.java共享使用的静态变量;因为Java不支持C++的全局变量概念,这里的静态变量就相当于C++的全局变量。

                                            表6.4  Java时间管理示例:GlobalVariables.java

  1. public class GlobalVariables
  2. {
  3.     public static double     g_currentTime = 0.0;
  4.     public static double     g_lookahead = 1.0;
  5.     public static boolean    g_bConstrained = false;
  6.     public static boolean    g_bRegulation = false;
  7.     public static boolean    g_granted = false;
  8.     public static int        g_hxPos;
  9.     public static int        g_hyPos;
  10.     //3 planes
  11.     public static int        g_hInstance1, g_hInstance2, g_hInstance3;
  12. }

       TimeManagement.java代码说明:

7行:联邦名称定义为“TimeManagementExample”;

21-26行:创建联邦执行;

28-34行:加入联邦执行;

37-39行:获取对象类及其属性句柄;

45行:公布对象类属性,只有公布之后才能够向RTI发送二维态势信息,即xPos和yPos;

46行:订购交互类属性,只有订购之后才能够从RTI收到二维态势信息;

48-53行:注册3架飞机;

60行:将仿真成员设置为时间管理受限的;

61-63行:等待RTI同意将该仿真成员设置为时间管理受限的;

65行:将仿真成员设置为时间管控成员;

66-68行:等待RTI同意将该仿真成员设置为时间管控成员;

70行:打开异步消息开关;

77行:仿真周期设置为1秒;这里的逻辑时间1对应物理时间的1秒(假设设置为2,则1个逻辑时间单位对应物理时间的0.5秒,2个逻辑时间单位对应仿真周期1秒);

83-167行:每隔1秒循环推进仿真,直到中断退出仿真;

100行:发送飞机在下一时刻的二维态势信息(如果采用RO消息也可以发送当前时刻的态势,当前或下一步信息依项目要求来抉择);

131行:将仿真请求推进到下一步;

132-134行:等待RTI同意该仿真成员推进到下一步;

169行:该行为注释行,表示仿真成员在结束时不需要调用'resignFederationExecution'和 'destroyFederationExecution'服务,RTI服务器会自动执行这两个服务。

                                      表6.5  Java时间管理示例:TimeManagement.java

  1. import MID.*;
  2. import RTI.*;
  3. public class TimeManagement
  4. {
  5.     public static void main(String[] args) {
  6.         String federationName = "TimeManagementExample";
  7.         String federateName = System.console().readLine("Please input the federate name: ");
  8.         HwFederateAmbassador fed;
  9.         RTI_RTIambassador rti;
  10.         try {
  11.             fed = new HwFederateAmbassador();
  12.             rti = new RTI_RTIambassador();
  13.         } catch(Exception ex) {
  14.             ex.printStackTrace();
  15.             return;
  16.         }
  17.         try {
  18.             rti.createFederationExecution(federationName, "tracer.fed");
  19.         } catch(Exception ex) {
  20.             // According to the HLA standard, only the first federate can call createFederationExecution successfully. Don't return.
  21.             ex.printStackTrace();
  22.         }
  23.         try {
  24.             int federateHandle = rti.joinFederationExecution(federateName, federationName, fed);
  25.             System.out.println("my federate handle is "+federateHandle);
  26.         } catch(Exception ex) {
  27.             ex.printStackTrace();
  28.             return;
  29.         }
  30.         try {
  31.             int hPlaneClass = rti.getObjectClassHandle("plane");
  32.             GlobalVariables.g_hxPos = rti.getAttributeHandle("xPos", hPlaneClass); //different from p1516
  33.             GlobalVariables.g_hyPos = rti.getAttributeHandle("yPos", hPlaneClass); //different from p1516
  34.             int[] theAttributes = new int[2];
  35.             theAttributes[0] = GlobalVariables.g_hxPos;
  36.             theAttributes[1] = GlobalVariables.g_hyPos;
  37.             rti.publishObjectClass(hPlaneClass, theAttributes);
  38.             rti.subscribeObjectClassAttributes(hPlaneClass, theAttributes);
  39.             //register one plane
  40.             GlobalVariables.g_hInstance1 = rti.registerObjectInstance(hPlaneClass);
  41.             //register 2nd plane
  42.             GlobalVariables.g_hInstance2 = rti.registerObjectInstance(hPlaneClass);
  43.             //register 3rd plane
  44.             GlobalVariables.g_hInstance3 = rti.registerObjectInstance(hPlaneClass);
  45.         } catch (Exception ex) {
  46.             ex.printStackTrace();
  47.             return;
  48.         }
  49.         try {
  50.             rti.enableTimeConstrained();
  51.             while(!GlobalVariables.g_bConstrained) {
  52.                 Thread.sleep(1);    //1 millisecond
  53.             }
  54.             rti.enableTimeRegulation(0.0, GlobalVariables.g_lookahead);
  55.             while(!GlobalVariables.g_bRegulation) {
  56.                 Thread.sleep(1);    //1 millisecond
  57.             }
  58.             rti.enableAsynchronousDelivery();
  59.         } catch (Exception ex) {
  60.             ex.printStackTrace();
  61.             return;
  62.         }
  63.         double targetTime = GlobalVariables.g_currentTime;
  64.         double intervalTime = 1;
  65.         int xPos, yPos;
  66.         String tag = "F15";
  67.         int step = 0;
  68.         java.util.Random r = new java.util.Random(); //get a random number
  69.         while(true) {
  70.             step++;
  71.             System.out.println("Step: "+step);
  72.             xPos=r.nextInt();
  73.             yPos=r.nextInt();
  74.             HandleValuePair[] theAttributeValues = new HandleValuePair[2];
  75.             theAttributeValues[0] = new HandleValuePair();
  76.             theAttributeValues[0].aHandle = GlobalVariables.g_hxPos;
  77.             theAttributeValues[0].aValue = String.valueOf(xPos); //int -> String
  78.             theAttributeValues[1] = new HandleValuePair();
  79.             theAttributeValues[1].aHandle = GlobalVariables.g_hyPos;
  80.             theAttributeValues[1].aValue = String.valueOf(yPos); //int -> String
  81.             try {
  82.                 rti.updateAttributeValues(GlobalVariables.g_hInstance1, theAttributeValues, GlobalVariables.g_currentTime + GlobalVariables.g_lookahead, tag);
  83.             } catch(RTI.ObjectNotKnown ex) {
  84.                 ex.printStackTrace();
  85.                 return;
  86.             } catch(RTI.AttributeNotDefined ex) {
  87.                 ex.printStackTrace();
  88.                 return;
  89.             } catch(RTI.AttributeNotOwned ex) {
  90.                 ex.printStackTrace();
  91.                 return;
  92.             } catch(RTI.InvalidFederationTime ex) {
  93.                 ex.printStackTrace();
  94.                 return;
  95.             } catch(RTI.FederateNotExecutionMember ex) {
  96.                 ex.printStackTrace();
  97.                 return;
  98.             } catch(RTI.SaveInProgress ex) {
  99.                 ex.printStackTrace();
  100.                 return;
  101.             } catch(RTI.RestoreInProgress ex) {
  102.                 ex.printStackTrace();
  103.                 return;
  104.             } catch(Exception ex) {
  105.                 ex.printStackTrace();
  106.                 return;
  107.             }
  108.             targetTime = GlobalVariables.g_currentTime + intervalTime;
  109.             System.out.println("This federate will advance to "+targetTime);
  110.             try {
  111.                 rti.timeAdvanceRequest(targetTime);
  112.                 while(!GlobalVariables.g_granted) {
  113.                     Thread.sleep(1);//1 millisecond
  114.                 }
  115.                 GlobalVariables.g_granted = false;
  116.                 System.out.println("The federate has advanced to "+GlobalVariables.g_currentTime);
  117.                 System.out.println();
  118.             } catch(RTI.InvalidFederationTime ex) {
  119.                 ex.printStackTrace();
  120.                 return;
  121.             } catch(RTI.FederationTimeAlreadyPassed ex) {
  122.                 ex.printStackTrace();
  123.                 return;
  124.             } catch(RTI.TimeAdvanceAlreadyInProgress ex) {
  125.                 ex.printStackTrace();
  126.                 return;
  127.             } catch(RTI.EnableTimeRegulationPending ex) {
  128.                 ex.printStackTrace();
  129.                 return;
  130.             } catch(RTI.EnableTimeConstrainedPending ex) {
  131.                 ex.printStackTrace();
  132.                 return;
  133.             } catch(RTI.FederateNotExecutionMember ex) {
  134.                 ex.printStackTrace();
  135.                 return;
  136.             } catch(RTI.SaveInProgress ex) {
  137.                 ex.printStackTrace();
  138.                 return;
  139.             } catch(RTI.RestoreInProgress ex) {
  140.                 ex.printStackTrace();
  141.                 return;
  142.             } catch (Exception ex) {
  143.                 ex.printStackTrace();
  144.                 return;
  145.             }
  146.         }
  147.         //After the program exits, the RTI will automatically calls 'resignFederationExecution' and 'destroyFederationExecution'.
  148.     }
  149. }

       HwFederateAmbassador.java代码说明:

5-7行:将发现的飞机输出到终端;

9-33行:将收到的飞机态势信息输出到终端;

35-39行:RTI同意将仿真成员设置为时间管控成员;

41-45行:RTI同意将仿真成员设置为时间管理受限的成员;

47-51行:RTI同意仿真成员推进到下一步。

                                      表6.6  Java时间管理示例:HwFederateAmbassador.java

  1. import MID.*;
  2. public class HwFederateAmbassador extends RTIFederateAmbassador
  3. {
  4.     public final void discoverObjectInstance(int theObject, int theObjectClass, String theObjectName) {
  5.         System.out.println("discoverObjectInstance: "+theObject+","+theObjectClass+","+theObjectName);
  6.     }
  7.     public final void reflectAttributeValues(int theObject, HandleValuePair[] theAttributes, double theTime, String theTag, MID.EventRetractionHandle theHandle) {
  8.         //call the next service.
  9.         reflectAttributeValues(theObject, theAttributes, theTag);
  10.     }
  11.     public final void reflectAttributeValues(int theObject, MID.HandleValuePair[] theAttributes, String theTag) {
  12.         System.out.println("reflectAttributeValues: " + theObject);
  13.         String value = new String();
  14.         for (int i = 0; i < theAttributes.length; ++i) {
  15.             if (theAttributes[i].aHandle == GlobalVariables.g_hxPos) {
  16.                 value = theAttributes[i].aValue;
  17.             } else if (theAttributes[i].aHandle == GlobalVariables.g_hyPos) {
  18.                 value = theAttributes[i].aValue;
  19.             } else {
  20.                 System.out.println("Receive wrong parameter handle.");
  21.             }
  22.             System.out.println("    <"+theAttributes[i].aHandle+","+value+">");
  23.         }
  24.         System.out.println("    tag:" + theTag);
  25.     }
  26.     public final void timeRegulationEnabled(double theFederateTime) {
  27.         GlobalVariables.g_currentTime = theFederateTime;
  28.         GlobalVariables.g_bRegulation = true;
  29.         System.out.println("timeRegulationEnabled: " + theFederateTime);
  30.     }
  31.     public final void timeConstrainedEnabled(double theFederateTime) {
  32.         GlobalVariables.g_currentTime = theFederateTime;
  33.         GlobalVariables.g_bConstrained = true;
  34.         System.out.println("timeRegulationEnabled: " + theFederateTime);
  35.     }
  36.     public final void timeAdvanceGrant(double theTime) {
  37.         GlobalVariables.g_currentTime = theTime;
  38.         GlobalVariables.g_granted = true;
  39.         System.out.println("timeAdvanceGrant: " + theTime);
  40.     }

6.2.4编译运行

       编译方法参照6.1.4.1执行,生成可执行程序之后就可以进行测试。

       测试项目:在银河麒麟操作系统上运行2个Java仿真成员,两个仿真成员启动后尽可能快地向前推进;测试KY-RTI的HLA的基本服务功能,特别是时间管理同步功能。

       测试步骤:

       第1步:启动KY-RTI。注意,KY-RTI的IP地址和端口号要与RTI.rid一致。如果没有RTI.rid文件,则程序在运行时会自动生成该文件。Java程序不关注tick开关。

       第2步:如图6.3和图6.4所示,开启两个终端,运行2个Java仿真成员,开始仿真。运行程序命令:

       java  TimeManagement

       测试结果表明:KY-RTI支持基于麒麟操作系统的Java仿真技术,时间管理同步功能强。

       测试说明:

       (1)图6.3是仿真成员“Air01”被Ctrl+C中断执行时的界面。此时,它能收到仿真成员“Air02”发送的二维态势信息。

       (2)图6.4是仿真成员“Air02”被Ctrl+C中断执行时的界面。此时,只显示它自己的运行信息,不会有其他仿真成员的二维态势信息。

                                      图6.3 使用时间管理服务的HLA仿真成员Air01

                                      图6.4 使用时间管理服务的HLA仿真成员Air02

KY-RTI的Linux、Windows版本和源码请联系作者:walt_lbq@163.com

KY-RTI分布仿真技术:前 言

KY-RTI分布仿真技术:第一章 简介

KY-RTI分布仿真技术:第二章 系统安装

KY-RTI分布仿真技术:第三章 KY-OMT对象模型模板工具

KY-RTI分布仿真技术:第四章 C++程序设计

KY-RTI分布仿真技术:第五章 Qt程序设计

KY-RTI分布仿真技术:第六章 Java程序设计

KY-RTI分布仿真技术:第七章 Visual C++程序设计

KY-RTI分布仿真技术:第八章 Visual C#程序设计

KY-RTI分布仿真技术:第九章 综合演示

KY-RTI分布仿真技术:附录1 分组聊天(HLA数据分发管理的应用)

KY-RTI分布仿真技术:附录2 大联邦(构建1000个成员的HLA/RTI仿真系统)

KY-RTI分布仿真技术:附录3 国产化(操作系统+CPUs)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

KY-RTI分布仿真技术:第六章 Java程序设计 的相关文章

随机推荐

  • Linux驱动与一般应用的区别【Linux驱动之路一】

    Linux驱动和一般应用的区别 xff0c 大致可以归类为以下几点 xff1a 一 Linux驱动 属于内核级 xff0c 驱动程序的崩溃会导致整个系统的崩溃 xff0c 例如在驱动程序中出现了非法指针的应用 xff0c 就会导致系统的崩溃
  • Docker 初学者指南 — 如何使用 Docker-Compose 创建客户端/服务器端

    您是一名开发人员并且想探索 docker compose xff1f 这篇文章是为你而写的 在对 Docker Compose 进行简短介绍后 xff0c 您将能够使用 Docker 创建您的第一个客户端 服务器端应用程序 注意 xff1a
  • WSTOOL中止下载后的错误。{ROS}

    运行wstool init j8 src hydro desktop full wet rosinstall时 xff0c 由于网络原因中止 xff0c 再开的时候会报错 错误提示 xff1a Error There already is
  • FreeRTOS 启动流程浅析 vTaskStartScheduler --待续

    1 Scheduler status xff1a 全局标志 xff1a static volatile BaseType t xSchedulerRunning 61 pdFALSE 取值 xff1a define taskSCHEDULE
  • Windows的linux子系统无法使用NFS

    需求 xff1a 不能装双系统 xff0c 虚拟机本地文件共享又不方便 xff0c 所以想要用win10商店的linux子系统 xff08 ubuntu18 04 xff09 配合NFS实现本地的linux环境编程测试 xff0c 再同步到
  • Docker

    文章目录 Docker1 Docker简介1 1 什么是虚拟化1 2 什么是Docker1 3 容器与虚拟机比较1 4 Docker 组件1 4 1 Docker服务器与客户端1 4 2 Docker镜像与容器1 4 3 Registry
  • tensorflow图优化详解

    一 运行时优化 Grappler是TensorFlow提供的运行时优化功能 xff0c 图1为Grappler模块主要功能的UML关系图 其中tensorflow grappler GrapplerItem 表示待优化的TensforFlo
  • 理解一维数组中 buf、buf[0]、&buf[0]、&buf 四个符号的含义

    本文内容摘自 C语言内核深度解析 一书的深入学习数组部分 以 int buf 100 61 0 为例 xff0c 集中讨论 buf buf 0 amp buf 0 amp buf 四个字符含义的内涵 1 buf xff1a 有两层含义 xf
  • 无人机航线规划软件[航线通]

    无人机航线规划软件 航线通 xff08 RoutePlan xff09 是数据禾 xff08 databox store xff09 研发的具有自主知识产权的无人机航线规划及飞行的移动端控制软件 xff0c 主要适用于大疆无人机 xff0c
  • Ubuntu20.04安装Cartographer_ros,conda环境X11问题

    absl的解决 conda 环境的 X11 问题 xff1a conda span class token function install span c conda forge xorg libx11
  • 单目视觉定位测距的两种方式

    单目定位和双目定位的选择 xff0c 我觉得主要还是成本和时间的考虑 之前也尝试过双目定位 xff0c 感觉要更精准些 xff0c 但双目测距需要对两幅图像进行图像变换和极线匹配 xff0c 稍微耗时了一些 这几天尝试了一下单摄像头进行测距
  • KY-RTI分布仿真技术:附录3 国产化(操作系统+CPUs)

    以操作系统和CPU为代表的国产化是当前仿真系统实现的必然趋势 本章以聊天程序为例 xff0c 展示了KY RTI在多种国产操作系统和国产CPU上的运行结果 聊天程序是一个入门程序 xff0c 本身比较简单 xff0c 不追求界面的美观 相信
  • KY-RTI分布仿真技术:前言

    前 言 自从美国国防部建模与仿真办公室 xff08 DMSO xff09 首次提出高层体系结构 xff08 High Level Architecture xff0c HLA xff09 概念以来 xff0c HLA仿真技术得到了迅猛发展
  • KY-RTI分布仿真技术:第一章 简介

    第一章 简介 高层体系结构 xff08 High Level Architecture xff0c HLA xff09 是美国国防部为了解决美军在各个领域开发出来的多种模型和各类仿真系统的互联和互操作问题而提出的一种分布式仿真标准 xff0
  • KY-RTI分布仿真技术:第二章 系统安装

    第二章 系统安装 本章介绍KY RTI在Linux和Windows操作系统下的安装方法 2 1 Linux安装 安装程序 xff1a RTI 1 3NGv6 tar gz 假设当前的Linux用户名为lbq xff0c HOME目录为 ho
  • KY-RTI分布仿真技术:第三章 KY-OMT对象模型模板工具

    第三章 KY OMT对象模型模板工具 本章介绍了对象模型模板的相关知识 xff0c 以及如何使用KY OMT对象模型模板工具创建对象模型文件 3 1 对象模型模板 HLA1 3包含3个标准 xff0c 第一个是描述整个联邦和联邦成员必须遵循
  • 基于SSM的后台管理系统总结

    文章目录 SSM环境搭建环境准备1 1 数据库与表结构1 2 maven工程搭建 pom 1 3编写实体类编写接口 SSM整合 web 与产品查询Spring环境搭建web xml 配置Spring MVC 环境搭建测试运行 资源地址 首先
  • KY-RTI分布仿真技术:第四章 C++程序设计

    第四章 C 43 43 程序设计 本章讲述如何在Linux操作系统上设计GNU C 43 43 程序 演示了2个程序 xff1a 聊天程序chat和时间管理程序time chat使用HLA的交互类进行通信 xff0c 没有采用tick服务
  • KY-RTI分布仿真技术:第五章 Qt程序设计

    第五章 Qt程序设计 本章讲述了如何基于Qt Creator设计控制台程序和图形界面程序 控制台程序相当于4 3节的聊天程序 xff1b 图形界面程序相当于4 4节的时间管理程序 图形界面程序近似于真实仿真项目 xff0c 讲述了如何设计仿
  • KY-RTI分布仿真技术:第六章 Java程序设计

    第六章 Java程序设计 本章讲述了如何基于Java设计聊天程序和时间管理程序 xff0c 两个程序都是控制台程序 聊天程序相当于4 3节的GNU C 43 43 聊天程序 xff1b 时间管理程序相当于4 4节的GNU C 43 43 程