⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nclient.h

📁 卡耐基.梅隆大学的机器人仿真软件(Redhat linux 9下安装)
💻 H
📖 第 1 页 / 共 5 页
字号:
 *  parameters: *     unsigned char data -- is the char to be stuffed *     unsigned char *buffer -- is the send buffer *     unsigned short *index -- is the buffer index which will be incremented *                              to reflect the bytes stuffed into the buffer */int stuffuchar(unsigned char data,	       unsigned char *buffer, unsigned short *index);/* *  stuff2byteuint - stuffs an unsigned short int(2 bytes) into the send buffer * *  parameters: *     unsigned short data -- is the value which will be split apart and  *                            stuffed bytewise into the send buffer *     unsigned char *buffer -- is the send buffer *     unsigned short *index -- is the buffer index which will be incremented *	                        to reflect the bytes stuffed into the buffer */int stuff2byteuint(unsigned short data, unsigned char *buffer, unsigned short *index);/* *  stuff4byteuint - stuffs an unsigned long int(4 bytes) into the send buffer * *  parameters: *     unsigned long data -- is the value which will be split apart and stuffed *	                     bytewise into the send buffer *     unsigned char *buffer -- is the send buffer *     unsigned short *index -- is the buffer index which will be incremented *	                        to reflect the bytes stuffed into the buffer */int stuff4byteuint(unsigned long data, unsigned char *buffer, unsigned short *index);/* *  stuffdouble - stuffs a double(8 bytes) into the send buffer * *  parameters: *     double data -- is the value which will be split apart and stuffed *	              bytewise into the send buffer *     unsigned char *buffer -- is the send buffer *     unsigned short *index -- is the buffer index which will be incremented *	                        to reflect the bytes stuffed into the buffer */int stuffdouble(double data, unsigned char *buffer, unsigned short *index);/* *  extractchar -  extracts a char from the receive buffer * *  parameters: *     unsigned char *buffer -- is the receive buffer which holds the data *     unsigned short *index -- is the receive buffer index which will be *                              incremented to reflect the position of the *                              next piece of data to be extracted */signed char extractchar(unsigned char *buffer, unsigned short *index);/* *  extract2byteint -  extracts a short int(2 bytes) from the receive buffer * *  parameters: *     unsigned char *buffer -- is the receive buffer which holds the data *     unsigned short *index -- is the receive buffer index which will be *                              incremented to reflect the position of the *                              next piece of data to be extracted */signed short extract2byteint(unsigned char *buffer, unsigned short *index);/* *  extract4byteint -  extracts a long int(4 bytes) from the receive buffer * *  parameters: *     unsigned char *buffer -- is the receive buffer which holds the data *     unsigned short *index -- is the receive buffer index which will be *                              incremented to reflect the position of the *                              next piece of data to be extracted */signed long extract4byteint(unsigned char *buffer, unsigned short *index);/* *  extractuchar -  extracts an unsigned char from the receive buffer * *  parameters: *     unsigned char *buffer -- is the receive buffer which holds the data *     unsigned short *index -- is the receive buffer index which will be *                              incremented to reflect the position of the *                              next piece of data to be extracted */unsigned char extractuchar(unsigned char *buffer, unsigned short *index);/* *  extract2byteuint -  extracts an unsigned short int(2 bytes) from the  *                      receive buffer * *  parameters: *     unsigned char *buffer -- is the receive buffer which holds the data *     unsigned short *index -- is the receive buffer index which will be *                              incremented to reflect the position of the *                              next piece of data to be extracted */unsigned short extract2byteuint(unsigned char *buffer, unsigned short *index);/* *  extract4byteuint -  extracts an unsigned long int(4 bytes) from the  *                      receive buffer * *  parameters: *     unsigned char *buffer -- is the receive buffer which holds the data *     unsigned short *index -- is the receive buffer index which will be *                              incremented to reflect the position of the *                              next piece of data to be extracted */unsigned long extract4byteuint(unsigned char *buffer, unsigned short *index);/* *  extractdouble -  extracts a double(8 bytes) from the receive buffer * *  parameters: *     unsigned char *buffer -- is the receive buffer which holds the data *     unsigned short *index -- is the receive buffer index which will be *                              incremented to reflect the position of the *                              next piece of data to be extracted */double extractdouble(unsigned char *buffer, unsigned short *index);/************************************************ *                                              * * Global variable access functions for Allegro *  * Common Lisp interface                        * *                                              * ************************************************/int get_state(long state[NUM_STATE]);int get_laser(int laser[2*NUM_LASER+1]);int get_mask(int mask[NUM_MASK]);int set_mask(int mask[NUM_MASK]);int set_server_machine_name(char *sname);int set_serv_tcp_port(int port);/************************************************* *                                               * * Functions for the attachment of position      * * data to sensory readings.                     * *                                               * *************************************************//*************** * FUNCTION:     posDataRequest * PURPOSE:      request position information for sensors * ARGUMENTS:    int posRequest :  *               The argument of this function specifies the sensors  *               for which the position information (PosData) should  *               be attached to the sensory reading. *               Its value is obtained by ORing the desired defines.  * EXAMPLE:      To attach PosData to sonars and laser: *               posDataRequest ( POS_SONAR | POS_LASER ); * ALGORITHM:    currently sets the global variable Smask[0] and *               then calls ct() to transmit the change to the server * RETURN:       TRUE if the argument was correct, else FALSE * SIDE EFFECT:  Smask[0] * CALLS:         * CALLED BY:     ***************/int posDataRequest ( int posRequest );/*************** * FUNCTION:     posDataCheck * PURPOSE:      return the sensors for which the PosData attachment *               is currently requested.  * ARGUMENTS:    None * ALGORITHM:    returns the usedSmask that is not globally accessible *               (is set by ct() to be the value of Smask[0]) * RETURN:       int, see posDataRequest *               the macros POS_*_P can be used to examine the value * SIDE EFFECT:   * CALLS:         * CALLED BY:     ***************/int posDataCheck ( void );/*************** * FUNCTION:     posInfraredRingGet * PURPOSE:      copy the PosData for all infrareds to accessible memory * ARGUMENTS:    PosData posData [INFRAREDS] : *               an array of PosData structures that is filled with  *               PosData. The position information for each infrared *               containts the configuration of the robot at the time  *               of the sensory reading and a timestamp for the  *               configuration and the senosry reading . * ALGORITHM:    copies blocks of memory * RETURN:       int, return always TRUE * SIDE EFFECT:   * CALLS:         * CALLED BY:     ***************/int posInfraredRingGet ( PosData posData[INFRAREDS] );/*************** * FUNCTION:     posInfraredGet * PURPOSE:      copy the PosData for a specific infrared to accessible  *               memory * ARGUMENTS:    PosData *posData : the memory location that the information *                                  will be copied to  *               int infraredNumber : the number of the infrared * ALGORITHM:    copies block of memory * RETURN:       int, always returns TRUE * SIDE EFFECT:   * CALLS:         * CALLED BY:     ***************/int posInfraredGet     ( PosData *posData , int infraredNumber );/*************** * FUNCTION:     posSonarRingGet * PURPOSE:      copy the PosData for all sonars to accessible memory * ARGUMENTS:    PosData posData [SONARS] : *               an array of PosData structures that is filled with  *               PosData. The position information for each sonar *               containts the configuration of the robot at the time  *               of the sensory reading and a timestamp for the  *               configuration and the senosry reading . * ALGORITHM:    copies blocks of memory * RETURN:       int, return always TRUE * SIDE EFFECT:   * CALLS:         * CALLED BY:     ***************/int posSonarRingGet    ( PosData posData[SONARS] );/*************** * FUNCTION:     posSonarGet * PURPOSE:      copy the PosData for a specific sonar to accessible memory * ARGUMENTS:    PosData *posData : the memory location that the information *                                  will be copied to  *                        int sonarNumber : the number of the sonar  * ALGORITHM:    copies block of memory * RETURN:       int, always returns TRUE * SIDE EFFECT:   * CALLS:         * CALLED BY:     ***************/int posSonarGet        ( PosData *posData , int sonarNumber );/*************** * FUNCTION:     posBumperGet * PURPOSE:      copy PosData for the bumper to accessible memory * ARGUMENTS:    PosData *posData : where the data is copied to  * ALGORITHM:    copies a block of memory * RETURN:       int, always returns TRUE * SIDE EFFECT:   * CALLS:         * CALLED BY:     * NOTE:         The bumper differs from other sensors in that the  *               posData is only updated after one of the bumper sensors  *               change its value from zero to one. This means that the  *               posData for the bumper always contains the position and  *               timeStamps of the latest hit, or undefined information  *               if the bumper was not hit yet. ***************/int posBumperGet       ( PosData *posData );/*************** * FUNCTION:     posLaserGet * PURPOSE:      copy PosData for the laser to accessible memory * ARGUMENTS:    PosData *posData : where the data is copied to  * ALGORITHM:    copies a block of memory * RETURN:       int, always returns TRUE * SIDE EFFECT:   * CALLS:         * CALLED BY:     * NOTE:         The laser is updated at a frequency of 30Hz. ***************/int posLaserGet        ( PosData *posData );/*************** * FUNCTION:     posCompassGet * PURPOSE:      copy PosData for the compass to accessible memory * ARGUMENTS:    PosData *posData : where the data is copied to  * ALGORITHM:    copies a block of memory * RETURN:       int, always returns TRUE * SIDE EFFECT:   * CALLS:         * CALLED BY:     * NOTE:         The compass is updated ad a frequency of 10Hz. ***************/int posCompassGet      ( PosData *posData );/*************** * FUNCTION:     posTimeGet * PURPOSE:      get the PosData time (Intellisys 100) in milliseconds * ARGUMENTS:    None * ALGORITHM:    --- * RETURN:       int  * SIDE EFFECT:   * CALLS:         * CALLED BY:     * NOTE:         The resolution of this timer is 16.4 milliseconds; *               the timer starts out at zero when the system is  *               turned on and will flow over after 49 days. ***************/int posTimeGet         ( void );/************************************************* *                                               * * Functions to determine the charge level       * * of the batteries for the cpu and the motors.  * *                                               * *************************************************//*************** * FUNCTION:     voltCpuGet * PURPOSE:      get the voltage of the power supply for the CPU * ARGUMENTS:    None * ALGORITHM:    --- * RETURN:       float (the voltage in volt) * SIDE EFFECT:   * CALLS:         * CALLED BY:     * NOTE:         This should never drop below 10.8 volts. ***************/float voltCpuGet       ( void );/*************** * FUNCTION:     voltMotorGet * PURPOSE:      get the voltage of the power supply for the motors * ARGUMENTS:    None * ALGORITHM:    --- * RETURN:       float (the voltage in volt) * SIDE EFFECT:   * CALLS:         * CALLED BY:     * NOTE:         This should never drop below 10.8 volts. *               Returns average of the two motor batteries. ***************/float voltMotorGet     ( void );#ifdef __cplusplus}#endif#endif /* _HOST_CLIENT_NCLIENT_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -