Revision: 8088
http://playerstage.svn.sourceforge.net/playerstage/?rev=8088&view=rev
Author: thjc
Date: 2009-07-23 13:55:12 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
updated nomad client to version that was released GPL on sourceforge
Modified Paths:
--------------
code/player/trunk/server/drivers/mixed/nomad/Nclient.c
code/player/trunk/server/drivers/mixed/nomad/Nclient.h
Modified: code/player/trunk/server/drivers/mixed/nomad/Nclient.c
===================================================================
--- code/player/trunk/server/drivers/mixed/nomad/Nclient.c 2009-07-23
11:17:12 UTC (rev 8087)
+++ code/player/trunk/server/drivers/mixed/nomad/Nclient.c 2009-07-23
13:55:12 UTC (rev 8088)
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 1991-2000 Nomadic Technologies
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
/*
* Nclient.c
*
@@ -2,8 +21,14 @@
* Implementation file for connection to robot and/or simulator via Nserver.
+ */
+
+/*
+ * $Log: Nclient.c,v $
+ * Revision 1.1.1.1 2001/08/23 19:05:14 bananajr
+ * initial commit
*
- * Copyright 1991-98, Nomadic Technologies, Inc.
- *
*/
-char cvsid_host_client_Nclient_c[] = "$Header:
/home/cvs/host/client/Nclient.c,v 1.26 1998/05/04 17:32:54 kamason Exp $";
+/* -- fixed a bug where initializing with an invalid robot id hung because
+ * Nclient tried to initialize sensors anyway -- rak, 16jun99
+ */
@@ -138,6 +163,7 @@
/* includes */
+#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
@@ -154,8 +180,6 @@
#include <netdb.h>
#include <fcntl.h>
#include <signal.h>
-#include <unistd.h>
-#include <string.h>
#include "Nclient.h"
#define DEBUG
@@ -243,11 +267,13 @@
/* function declaration */
+int gethostname(char *name, int len);
static int posDataProcess (long *buffer, int current, PosData *posData);
-static int timeDataProcess (long *buffer, int current, TimeData *time );
+static int timeDataProcess (long *buffer, int current, TimeData *theTime );
static int voltDataProcess (long *buffer, int current,
unsigned char *voltCPU, unsigned char *voltMotor);
static float voltConvert ( unsigned char reading , float range );
+char *convertAddr ( char *name, char *addr );
/*************************
* *
@@ -289,7 +315,6 @@
else
strcpy(Host_name, SERVER_MACHINE_NAME);
}
-
if ( ((hp = gethostbyname(Host_name)) == NULL) &&
((hp = gethostbyaddr(convertAddr(Host_name,addr),4,AF_INET)) == NULL ) )
{
@@ -687,7 +712,7 @@
static int process_compass_reply(struct reply_struct *this_reply)
{
- int i = 0;
+ int i;
if (this_reply->type == ERROR_MSG)
{
@@ -714,7 +739,7 @@
static int process_bumper_reply(struct reply_struct *this_reply)
{
- int i=0;
+ int i;
if (this_reply->type == ERROR_MSG)
{
@@ -982,7 +1007,7 @@
if (first)
{
- fprintf(stderr, "Nclient version 2.6.11\n");
+ fprintf(stderr, "Nclient version 2.7\n");
fprintf(stderr, "Copyright 1991-1998, Nomadic Technologies, Inc.\n");
first = 0;
}
@@ -1002,6 +1027,11 @@
{
error = process_socket_reply(&the_reply);
+ /* if there was an error, we must not initialize the sensors,
+ * but return an error immediately instead */
+ if (error == 0)
+ return 0;
+
/* initialize clients Smask to match the one on the server side */
init_sensors();
@@ -1408,7 +1438,7 @@
int tk(char *talk_string)
{
the_request.type = TK_MSG;
- the_request.size = (strlen(talk_string)+3)/4;
+ the_request.size = (strlen(talk_string)+4)/4;
strcpy((char *)the_request.mesg, talk_string);
if (ipc_comm(&the_request, &the_reply))
@@ -3571,9 +3601,9 @@
* CALLS:
* CALLED BY:
***************/
-static int timeDataProcess ( long *buffer, int current, TimeData *time )
+static int timeDataProcess ( long *buffer, int current, TimeData *theTime )
{
- *time = (unsigned long) buffer[current];
+ *theTime = (unsigned long) buffer[current];
return ( current + 1 );
}
@@ -3610,7 +3640,7 @@
{
long result;
- unsigned short b_index, b_length;
+ short b_index, b_length;
unsigned char serial_number;
unsigned char packet_type;
unsigned char user_send_buffer[256];
@@ -3635,7 +3665,7 @@
{
long result;
- unsigned short b_index, b_length;
+ short b_index, b_length;
unsigned char serial_number;
unsigned char packet_type;
unsigned char user_send_buffer[256];
@@ -3665,7 +3695,7 @@
{
long result;
- unsigned short b_index, b_length;
+ short b_index, b_length;
unsigned char serial_number;
unsigned char packet_type;
unsigned char user_send_buffer[256];
Modified: code/player/trunk/server/drivers/mixed/nomad/Nclient.h
===================================================================
--- code/player/trunk/server/drivers/mixed/nomad/Nclient.h 2009-07-23
11:17:12 UTC (rev 8087)
+++ code/player/trunk/server/drivers/mixed/nomad/Nclient.h 2009-07-23
13:55:12 UTC (rev 8088)
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 1991-2000 Nomadic Technologies
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
/*
* Nclient.h
*
@@ -3,11 +22,13 @@
* Interface file for direct connections to the robot or for
* connections to Nserver.
- *
- * Copyright 1991-1998, Nomadic Technologies, Inc.
+ */
+
+/*
+ * $Log: Nclient.h,v $
+ * Revision 1.1.1.1 2001/08/23 19:05:14 bananajr
+ * initial commit
*
*/
-/* $Header: /home/cvs/host/client/Nclient.h,v 1.25 1998/05/04 17:34:52 kamason
Exp $ */
-
#ifndef _HOST_CLIENT_NCLIENT_H_
#define _HOST_CLIENT_NCLIENT_H_
@@ -92,7 +113,9 @@
#define STATE_CONF_STEER 36
#define STATE_CONF_TURRET 37
#define STATE_VEL_TRANS 38
+#define STATE_VEL_RIGHT 38 /* for scout */
#define STATE_VEL_STEER 39
+#define STATE_VEL_LEFT 39 /* for scout */
#define STATE_VEL_TURRET 40
#define STATE_MOTOR_STATUS 41
#define STATE_LASER 42
@@ -186,6 +209,12 @@
#define ARM_WS 41
#define ARM_MV 42
+/*
+ * function prototypes for arm
+ */
+long arm_mv(long l_mode, long l_v, long g_mode, long g_v);
+long arm_ws(short lift, short grip, long timeout, long *time_remain);
+long arm_zr(short mode);
/*
* For requesting the PosData the following defines should be used.
@@ -263,6 +292,14 @@
#define USER_BUFFER_LENGTH 0xFFFF
+/* these definitions apply to the Scout and SuperScout */
+#define ROTATION_CONSTANT 0.118597 /* inches/degree (known to 100 ppm) */
+
+#define RIGHT(trans, steer) (trans + (int)((float)steer*ROTATION_CONSTANT))
+#define LEFT(trans, steer) (trans - (int)((float)steer*ROTATION_CONSTANT))
+
+#define scout_vm(trans, steer) vm(RIGHT(trans, steer), LEFT(trans, steer), 0)
+
/********************
* *
* Type definitions *
@@ -567,8 +604,6 @@
*/
int connect_robot(long robot_id, ...);
-int old_connect_robot(long robot_id); /* added by Deryck Morales */
-
/*
* disconnect_robot - requests the server to close the connect with robot
* with id = robot_id.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit