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

2023-05-16

第八章 Visual C#程序设计

       本章讲述如何基于Visual C#设计ping、pong程序。本质上是对上一章Visual C++程序的一次成功移植。对于不同的程序设计语言而言,基于HLA/RTI设计仿真应用的方法都差不多,而关键在于RTI软件能否支持相应程序设计语言的开发,用户关心一下调用接口即可,通过调用接口可以设计形式多样的程序。与C++调用接口的一个显著区别在于句柄和时间的表示,Visual C#中的各种句柄全部用int表示,各类时间则用double表示。Visual C#与Java编程风格相似,开发的仿真程序可以相互借鉴。

8.1需求分析

       开发2个程序,一个为ping,一个为pong;两者都不使用tick服务。

       这两个程序就像2个人打乒乓球一样,1个程序向另一个程序发送1个事件;另一个人收到事件后再给对方发送1个事件;如此循环往复。

8.2项目设计

       按照需求,将要开发的两个程序叫做ping-notick和pong-notick。该项目与时间无关,不需要时间管理服务。本项目采用交互类,并借用KY-RTI的bin目录下已有的chat.fed文件来传输交互。该交互类名为chat,有name和sentence两个参数,如下列代码所示。

class chat {           //交互类

       string  name;     //参数

       string  sentence; //参数

}

       在本项目中,两个程序的name分别设为“ping”和“pong”;sentence为要传输的字符串,其长度可变,具体的值由用户输入确定。

       在本项目中存在一个问题,两个程序总有一个程序先启动,另一个后启动;先启动的程序需要等待另一个程序启动后再协同仿真。基于KY-RTI开发的仿真成员是面向多线程的,主线程负责向RTI发送请求;回调线程负责从RTI接收请求。本项目让ping-notick先启动,通过一个布尔变量来确定回调线程是否收到了回调消息,当收到了第1个回调消息时,表明pong-notick也已经启动了;pong-notick也通过一个布尔变量来确定回调线程是否收到了回调消息。

8.3 ping-notick代码设计

       该程序由Program.cs和HwFederateAmbassador.cs两个文件组成。前者负责发送交互,后者负责从RTI接收交互,两者在执行时处于2个独立的线程中。在Program.cs中定义了2个类:Definitions和Program。Definitions类定义了一组静态变量,由主线程和回调线程共享,相当于C++语言中的全局变量,这与Java很像。

       Program.cs代码说明:

12-24行:定义Definitions类;

14行:定义变量STEP,用来表示发送多少次交互后仿真结束,初始值为100;

15行:发送1个交互时要传输的字节数;

19-21行:定义交互类及其参数句柄变量;

35-41行:输入要传输的字节数;

43-49行:输入要发送的交互数;

58-64行:创建联邦执行;

66-81行:加入联邦执行;

88-92行:获取交互类及其参数句柄;

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

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

99-102行:根据要发送的字节数生成字符串;

104-113行:生成要传输的交互信息,将name和sentence打包,后面直接调用sendInteraction发送;

123-132行:循环操作,每次等待回调线程收到交互,然后发送1个交互;

131-133行:如果发送的交互数不等于接收的交互数,则循环等待;

144-153行:退出联邦执行,不再参加仿真;

162-175行:销毁联邦。如果是最后一个仿真成员执行该操作,则整个仿真结束。

                                                 表8.1  Visual C# ping-notick示例:program.cs

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using RTI;
  6. using MID; //定义数据类型,例如HandleValuePair;
  7. using System.Threading; //for sleep
  8. using MYFED;
  9. namespace test
  10. {
  11. class Definitions
  12. {
  13.     public static int   STEP = 100;
  14.     public static int   data_size = 1024;
  15.     public static int   receivedInteractions = 0; //收到多少个交互
  16.     //定义交互类句柄和参数句柄
  17.     public static int   hChatClass = -1;    //对应chat.xml中的chat交互类
  18.     public static int   hChatName = -1;     //对应chat交互类的name参数
  19.     public static int   hChatSentence = -1; //对应chat交互类的sentence参数
  20.     public static bool received = false;    //收到1个交互
  21. }
  22. class Program
  23. {
  24.     static void Main(string[] args) {
  25.         RTI.RTIambassador rti = null;
  26.         string federationExecutionName = "chat";   //联盟名称
  27.         string  FEDfile = "chat.fed";               //FED文件
  28.         string  federateType = "ping";              //盟员名称
  29.         Console.WriteLine("请输入要传输的字节数:"); //pingpong要一致
  30.         Definitions.data_size = int.Parse(Console.ReadLine());
  31.         if (Definitions.data_size <= 0) {
  32.             Console.WriteLine("字节数不正确");
  33.             return;
  34.         }
  35.         Console.WriteLine("请输入交互次数:");      //pingpong要一致
  36.         Definitions.STEP = int.Parse(Console.ReadLine());
  37.         if (Definitions.STEP < 1) {
  38.             Console.WriteLine("交互次数不正确");
  39.             return;
  40.         }
  41.         try {
  42.             rti = new RTI.RTIambassador();                        // libRTI provided
  43.             MYFED.HwFederateAmbassador myfed = new MYFED.HwFederateAmbassador(); // User-defined
  44.             RTI.FederateAmbassador fedAmb = (RTI.FederateAmbassador)myfed;
  45.             int     federateId;
  46.             try {
  47.                 rti.createFederationExecution(federationExecutionName, FEDfile);
  48.             } catch ( RTI.FederationExecutionAlreadyExists ) {
  49.                 Console.WriteLine("FED_HW: Note: Federation execution already exists.");
  50.             } catch (Exception) {
  51.                 Console.WriteLine("FED_HW: ERROR: Failed to create federation execution.");
  52.             }
  53.             try {
  54.                 Console.WriteLine("FED_HW: JOINING FEDERATION EXECUTION: ");
  55.                 federateId = rti.joinFederationExecution( federateType,
  56.                              federationExecutionName,
  57.                              ref fedAmb);
  58.             } catch (RTI.FederateAlreadyExecutionMember) {
  59.                 Console.WriteLine("FED_HW: ERROR: federate already exists in the Federation Execution " + federationExecutionName+".");
  60.                 return;
  61.             } catch (RTI.FederationExecutionDoesNotExist) {
  62.                 Console.WriteLine("FED_HW: ERROR: Federation Execution does not exists.");
  63.                 return;
  64.             } catch (Exception) {
  65.                 Console.WriteLine("FED_HW: ERROR: Failed to join federation execution.");
  66.                 return;
  67.             }
  68.             Console.WriteLine("FED_HW: JOINED SUCCESSFULLY: : Federate Handle = " + federateId);
  69.             //
  70.             //获取交互类句柄
  71.             Definitions.hChatClass = rti.getInteractionClassHandle("chat");
  72.             //获取交互类参数句柄
  73.             Definitions.hChatName = rti.getParameterHandle("name", Definitions.hChatClass);
  74.             Definitions.hChatSentence = rti.getParameterHandle("sentence", Definitions.hChatClass);
  75.             //公布交互类,这样可以向RTI发送信息
  76.             rti.publishInteractionClass(Definitions.hChatClass);
  77.             //定购交互类,这样可以接受来自其它发布者的信息
  78.             rti.subscribeInteractionClass(Definitions.hChatClass);
  79.             string szSentence = "";
  80.             for(int i=0; i<Definitions.data_size; i++) {
  81.                 szSentence+="a";
  82.             }
  83.             HandleValuePair[] pParams = new HandleValuePair[2];
  84.             // Add Name
  85.             pParams[0] = new HandleValuePair();
  86.             pParams[0].aHandle = Definitions.hChatName;
  87.             pParams[0].aValue = federateType;
  88.             // Add Sentence
  89.             pParams[1] = new HandleValuePair();
  90.             pParams[1].aHandle = Definitions.hChatSentence;
  91.             pParams[1].aValue = szSentence;
  92.             for (int i = 0; i < Definitions.STEP; i++) {
  93.                 while (!Definitions.received) {
  94.                     Thread.Sleep(1);   //睡眠1豪秒
  95.                 }
  96.                 Definitions.received = false; //不要放到rti.sendInteraction之后
  97.                 //发送交互,所有定购者(不包括自己)都会在HwFederateAmbassador.cpp中的receiveInteraction服务中收到该交互。
  98.                 try {
  99.                     rti.sendInteraction(Definitions.hChatClass, pParams, "");
  100.                 } catch(Exception) {
  101.                     Console.WriteLine("error for send interaction");
  102.                 }
  103.             }
  104.             while (Definitions.STEP != Definitions.receivedInteractions) { //如果发送的交互数不等于接收的交互数,则循环等待
  105.                 Thread.Sleep(1000);   //睡眠1
  106.             }
  107.             //如果程序正常退出,则表明发送的交互数等于接收的交互数,没有丢失消息.
  108.         } catch (RTI.ConcurrentAccessAttempted e) {
  109.             Console.WriteLine(e.Message);
  110.             return;
  111.         } catch (Exception e) {
  112.                 Console.WriteLine("FED_HW: ERROR: this program meets an exception."+e.Message);
  113.             return;
  114.         }
  115.         try {
  116.             Console.WriteLine("FED_HW: RESIGN FEDERATION EXECUTION CALLED");
  117.             rti.resignFederationExecution(
  118.                 ResignAction.DELETEOBJECTSANDRELEASEATTRIBUTES);
  119.                  Console.WriteLine("FED_HW: SUCCESSFUL RESIGN FEDERATION EXECUTION CALLED");
  120.         } catch (Exception) {
  121.             Console.WriteLine("FED_HW: ERROR: resign federation execution");
  122.             return;
  123.         }
  124.         //------------------------------------------------------
  125.         // Destroy the federation execution in case we are the
  126.         // last federate. This will not do anything bad if there
  127.         // other federates joined.  The RTI will throw us an
  128.         // exception telling us that other federates are joined
  129.         // and we can just ignore that.
  130.         //------------------------------------------------------
  131.         try {
  132.             Console.WriteLine("FED_HW: DESTROY FEDERATION EXECUTION CALLED");
  133.             rti.destroyFederationExecution(federationExecutionName);
  134.                  Console.WriteLine("FED_HW: SUCCESSFUL DESTROY FEDERATION EXECUTION CALLED");
  135.         } catch (RTI.FederatesCurrentlyJoined) {
  136.             Console.WriteLine("FED_HW: FederatesCurrentlyJoined");
  137.             return;
  138.         } catch (RTI.FederationExecutionDoesNotExist) {
  139.             Console.WriteLine("FED_HW: FederationExecutionDoesNotExist");
  140.             return;
  141.         } catch (Exception) {
  142.             Console.WriteLine("FED_HW: ERROR: destroy federation execution");
  143.             return;
  144.         }
  145.     }
  146. }
  147. }

       HwFederateAmbassador.cs代码说明:

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

16-20行:通知主线程收到交互。

                                                 表8.2  Visual C#示例:HwFederateAmbassador.cs

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using MID; //定义数据类型,例如HandleValuePair
  6. using test;
  7. namespace MYFED
  8. {
  9. public class HwFederateAmbassador : RTI.FederateAmbassador
  10. {
  11.     public override void receiveInteraction(int theInteraction, HandleValuePair[] theParameters, double theTime, string theTag, EventRetractionHandle theHandle) {
  12.         receiveInteraction(theInteraction, theParameters, theTag);
  13.     }
  14.     public override void receiveInteraction(int theInteraction, HandleValuePair[] theParameters, string theTag) {
  15.         Definitions.receivedInteractions++;
  16.         Console.WriteLine(Definitions.receivedInteractions+" received an interaction from pong");
  17.         Definitions.received = true;
  18.     }
  19. }
  20. }

8.4 pong-notick代码设计

       该程序由Program.cs和HwFederateAmbassador.cs两个文件组成。前者负责发送交互,后者负责从RTI接收交互,两者在执行时处于2个独立的线程中。在Program.cs中定义了2个类:Definitions和Program。Definitions类定义了一组静态变量,由主线程和回调线程共享,相当于C++语言中的全局变量,这与Java很像。

       Program.cs代码说明:

12-24行:定义Definitions类;

14行:定义变量STEP,用来表示发送多少次交互后仿真结束,初始值为100;

15行:发送1个交互时要传输的字节数;

19-21行:定义交互类及其参数句柄变量;

35-41行:输入要传输的字节数;

43-49行:输入要发送的交互数;

58-64行:创建联邦执行;

66-81行:加入联邦执行;

86-90行:获取交互类及其参数句柄;

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

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

97-100行:根据要发送的字节数生成字符串;

102-111行:生成要传输的交互信息,将name和sentence打包,后面直接调用sendInteraction发送;

113-127行:循环操作,每次发送1个交互,然后等待回调线程收到交互;

129-131行:如果发送的交互数不等于接收的交互数,则循环等待;

142-151行:退出联邦执行,不再参加仿真;

160-173行:销毁联邦。如果是最后一个仿真成员执行该操作,则整个仿真结束。

                                                 表8.3  Visual C# pong示例:Program.cs

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using RTI;
  6. using MID; //定义数据类型,例如HandleValuePair;
  7. using System.Threading; //for sleep
  8. using MYFED;
  9. namespace test
  10. {
  11. class Definitions
  12. {
  13.     public static int   STEP = 100;
  14.     public static int   data_size = 1024;
  15.     public static int   receivedInteractions = 0; //收到多少个交互
  16.     //定义交互类句柄和参数句柄
  17.     public static int   hChatClass = -1;    //对应chat.xml中的chat交互类
  18.     public static int   hChatName = -1;     //对应chat交互类的name参数
  19.     public static int   hChatSentence = -1; //对应chat交互类的sentence参数
  20.     public static bool  received = false;    //收到1个交互
  21. }
  22. class Program
  23. {
  24.     static void Main(string[] args) {
  25.         RTI.RTIambassador rti = null;
  26.         string federationExecutionName = "chat";   //联盟名称
  27.         string FEDfile = "chat.fed";                 //FED文件
  28.         string  federateType = "pong";               //盟员名称
  29.         Console.WriteLine("请输入要传输的字节数:"); //pingpong要一致
  30.         Definitions.data_size = int.Parse(Console.ReadLine());
  31.         if (Definitions.data_size <= 0) {
  32.             Console.WriteLine("字节数不正确");
  33.             return;
  34.         }
  35.         Console.WriteLine("请输入交互次数:");      //pingpong要一致
  36.         Definitions.STEP = int.Parse(Console.ReadLine());
  37.         if (Definitions.STEP < 1) {
  38.             Console.WriteLine("交互次数不正确");
  39.             return;
  40.         }
  41.         try {
  42.             rti = new RTI.RTIambassador();
  43.             MYFED.HwFederateAmbassador myfed = new MYFED.HwFederateAmbassador();
  44.             RTI.FederateAmbassador fedAmb = (RTI.FederateAmbassador)myfed;
  45.             int     federateId;
  46.             try {
  47.                 rti.createFederationExecution(federationExecutionName, FEDfile);
  48.             } catch ( RTI.FederationExecutionAlreadyExists) {
  49.                 Console.WriteLine("FED_HW: Note: Federation execution already exists.");
  50.             } catch (Exception) {
  51.                 Console.WriteLine("FED_HW: ERROR: Failed to create federation execution.");
  52.             }
  53.             try {
  54.                 Console.WriteLine("FED_HW: JOINING FEDERATION EXECUTION: ");
  55.                 federateId = rti.joinFederationExecution( federateType,
  56.                              federationExecutionName,
  57.                              ref fedAmb);
  58.             } catch (RTI.FederateAlreadyExecutionMember) {
  59.                 Console.WriteLine("FED_HW: ERROR: federate already exists in the Federation Execution " + federationExecutionName+".");
  60.                 return;
  61.             } catch (RTI.FederationExecutionDoesNotExist) {
  62.                 Console.WriteLine("FED_HW: ERROR: Federation Execution does not exists.");
  63.                 return;
  64.             } catch (Exception) {
  65.                 Console.WriteLine("FED_HW: ERROR: Failed to join federation execution.");
  66.                 return;
  67.             }
  68.             /
  69.             //获取交互类句柄
  70.             Definitions.hChatClass = rti.getInteractionClassHandle("chat");
  71.             //获取交互类参数句柄
  72.             Definitions.hChatName = rti.getParameterHandle("name", Definitions.hChatClass);
  73.             Definitions.hChatSentence = rti.getParameterHandle("sentence", Definitions.hChatClass);
  74.             //公布交互类,这样可以向RTI发送信息
  75.             rti.publishInteractionClass(Definitions.hChatClass);
  76.             //定购交互类,这样可以接受来自其它发布者的信息
  77.             rti.subscribeInteractionClass(Definitions.hChatClass);
  78.             string szSentence = "";
  79.             for(int i=0; i<Definitions.data_size; i++) {
  80.                 szSentence+="a";
  81.             }
  82.             HandleValuePair[] pParams = new HandleValuePair[2];
  83.             // Add Name
  84.             pParams[0] = new HandleValuePair();
  85.             pParams[0].aHandle = Definitions.hChatName;
  86.             pParams[0].aValue = federateType;
  87.             // Add Sentence
  88.             pParams[1] = new HandleValuePair();
  89.             pParams[1].aHandle = Definitions.hChatSentence;
  90.             pParams[1].aValue = szSentence;
  91.             for (int i = 0; i < Definitions.STEP; i++) {
  92.                 Definitions.received = false; //不要放到rti.sendInteraction之后
  93.                 //发送交互,所有定购者(不包括自己)都会在HwFederateAmbassador.cpp中的receiveInteraction服务中收到该交互。
  94.                 try {
  95.                     rti.sendInteraction(Definitions.hChatClass, pParams, "");
  96.                 } catch(Exception) {
  97.                     Console.WriteLine("error for send interaction");
  98.                 }
  99.                 while (!Definitions.received) {
  100.                     Thread.Sleep(1);   //睡眠1豪秒
  101.                 }
  102.             }
  103.             while (Definitions.STEP != Definitions.receivedInteractions) { //如果发送的交互数不等于接收的交互数,则循环等待
  104.                 Thread.Sleep(1000);   //睡眠1
  105.             }
  106.             //如果程序正常退出,则表明发送的交互数等于接收的交互数,没有丢失消息.
  107.         } catch (RTI.ConcurrentAccessAttempted e) {
  108.             Console.WriteLine(e.Message);
  109.             return;
  110.         } catch (Exception e) {
  111.             Console.WriteLine("FED_HW: ERROR: this program meets an exception."+e.Message);
  112.             return;
  113.         }
  114.         try {
  115.             Console.WriteLine("FED_HW: RESIGN FEDERATION EXECUTION CALLED");
  116.             rti.resignFederationExecution(
  117.                 ResignAction.DELETEOBJECTSANDRELEASEATTRIBUTES);
  118.             Console.WriteLine("FED_HW: SUCCESSFUL RESIGN FEDERATION EXECUTION CALLED");
  119.         } catch (Exception) {
  120.             Console.WriteLine("FED_HW: ERROR: resign federation execution");
  121.             return;
  122.         }
  123.         //------------------------------------------------------
  124.         // Destroy the federation execution in case we are the
  125.         // last federate. This will not do anything bad if there
  126.         // other federates joined.  The RTI will throw us an
  127.         // exception telling us that other federates are joined
  128.         // and we can just ignore that.
  129.         //------------------------------------------------------
  130.         try {
  131.             Console.WriteLine("FED_HW: DESTROY FEDERATION EXECUTION CALLED");
  132.             rti.destroyFederationExecution(federationExecutionName);
  133.                  Console.WriteLine("FED_HW: SUCCESSFUL DESTROY FEDERATION EXECUTION CALLED");
  134.         } catch (RTI.FederatesCurrentlyJoined /* e */ ) {
  135.             Console.WriteLine("FED_HW: FederatesCurrentlyJoined");
  136.             return;
  137.         } catch (RTI.FederationExecutionDoesNotExist) {
  138.             Console.WriteLine("FED_HW: FederationExecutionDoesNotExist");
  139.             return;
  140.         } catch (Exception) {
  141.             Console.WriteLine("FED_HW: ERROR: destroy federation execution");
  142.             return;
  143.         }
  144.     }
  145. }
  146. }

       HwFederateAmbassador.cs代码说明:

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

16-20行:通知主线程收到交互。

                                                 表8.4  Visual C# pong示例:HwFederateAmbassador.cs

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using MID; //定义数据类型,例如HandleValuePair
  6. using test;
  7. namespace MYFED
  8. {
  9. public class HwFederateAmbassador : RTI.FederateAmbassador
  10. {
  11.     public override void receiveInteraction(int theInteraction, HandleValuePair[] theParameters, double theTime, string theTag, EventRetractionHandle theHandle) {
  12.         receiveInteraction(theInteraction, theParameters, theTag);
  13.     }
  14.     public override void receiveInteraction(int theInteraction, HandleValuePair[] theParameters, string theTag) {
  15.         Definitions.receivedInteractions++;
  16.         Console.WriteLine(Definitions.receivedInteractions + " received an interaction from ping");
  17.         Definitions.received = true;
  18.     }
  19. }
  20. }

8.5编译运行

       下面以Visual C# 2010为例说明编译运行过程。

       第1步:编译。以ping-notick程序为例说明,pong-notick程序的设置与此相同。

       (1)选择左侧“ping-notick”根节点,按右键选择“属性”,打开属性对话框。

                                                 图8.1 选择项目属性

       (2)设置项目属性。通常取缺省值,但也有用户可能有特殊要求。譬如,在Visual C# 2010下,KY-RTI为.Net Framework 3.5和.Net Framework 4两种目标框架提供支持。

                                                 图8.2 设置目标框架

       (3)添加引用。选择左侧“引用”节点,按右键选择“添加引用”。通过“浏览”找到KY-RTI\lib目录下的.dll文件,选择自己需要的.dll文件。

                                                 图8.3 添加引用

                                                 图8.4 浏览引用库

       第2步:编译,生成可执行程序。

       第3步:启动KY-RTI。注意,KY-RTI的IP地址和端口号要与RTI.rid一致。

       第4步:开启两个终端,分别运行ping-notick和pong-notick这2个仿真成员,开始仿真。如图8.5和图8.6所示。在这个例子中,每次传输的字节数为100个字节,一共来回10次。另外,基于Visual C#开发程序,则程序不需要调用tick服务,否则会有1个警告。

                                                 图8.5 ping-notick运行结果

                                                 图8.6 pong-notick运行结果

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分布仿真技术:第八章 Visual C#程序设计 的相关文章

随机推荐

  • 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 程
  • KY-RTI分布仿真技术:第七章 Visual C++程序设计

    第七章 Visual C 43 43 程序设计 本章讲述如何基于Visual C 43 43 设计仿真程序 演示了2个程序 xff1a ping程序和pong程序进行相互之间的通信 程序使用HLA的交互类进行通信 xff0c Visual
  • KY-RTI分布仿真技术:第八章 Visual C#程序设计

    第八章 Visual C 程序设计 本章讲述如何基于Visual C 设计ping pong程序 本质上是对上一章Visual C 43 43 程序的一次成功移植 对于不同的程序设计语言而言 xff0c 基于HLA RTI设计仿真应用的方法