[Fawkes Git] branch/slakani/navi_extended: created (0.4.1-1076-g48c9135)

Safoura Rezapour Lakani safoura.lakani at rwth-aachen.de
Fri Sep 28 11:00:42 CEST 2012


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, slakani/navi_extended has been created
        at  48c9135edde2245319d0130cfb7d87f81dbf839e (commit)

http://git.fawkesrobotics.org/fawkes.git/slakani/navi_extended

- *Log* ---------------------------------------------------------------
commit 48c9135edde2245319d0130cfb7d87f81dbf839e
Author:     Safoura Rezapour Lakani <safoura.lakani at rwth-aachen.de>
AuthorDate: Fri Sep 28 10:54:43 2012 +0200
Commit:     Safoura Rezapour Lakani <safoura.lakani at rwth-aachen.de>
CommitDate: Fri Sep 28 10:54:43 2012 +0200

    navigator-interface: extend by drive mode enum

http://git.fawkesrobotics.org/fawkes.git/commit/48c9135
http://trac.fawkesrobotics.org/changeset/48c9135

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------


- *Diffs* -------------------------------------------------------------

- *commit* 48c9135edde2245319d0130cfb7d87f81dbf839e - - - - - - - - - -
Author:  Safoura Rezapour Lakani <safoura.lakani at rwth-aachen.de>
Date:    Fri Sep 28 10:54:43 2012 +0200
Subject: navigator-interface: extend by drive mode enum

 src/libs/interfaces/NavigatorInterface.cpp   |  163 +++++++++++++++++++++++++-
 src/libs/interfaces/NavigatorInterface.h     |   54 +++++++++
 src/libs/interfaces/NavigatorInterface.tolua |   35 ++++++
 src/libs/interfaces/NavigatorInterface.xml   |   28 +++++
 4 files changed, 279 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/interfaces/NavigatorInterface.cpp b/src/libs/interfaces/NavigatorInterface.cpp
index 0fd1f97..28b01e7 100644
--- a/src/libs/interfaces/NavigatorInterface.cpp
+++ b/src/libs/interfaces/NavigatorInterface.cpp
@@ -93,6 +93,7 @@ NavigatorInterface::NavigatorInterface() : Interface()
   add_fieldinfo(IFT_FLOAT, "max_velocity", 1, &data->max_velocity);
   add_fieldinfo(IFT_FLOAT, "security_distance", 1, &data->security_distance);
   add_fieldinfo(IFT_BOOL, "escaping_enabled", 1, &data->escaping_enabled);
+  add_fieldinfo(IFT_ENUM, "drive_mode", 1, &data->drive_mode, "DriveMode");
   add_messageinfo("StopMessage");
   add_messageinfo("TurnMessage");
   add_messageinfo("CartesianGotoMessage");
@@ -103,7 +104,8 @@ NavigatorInterface::NavigatorInterface() : Interface()
   add_messageinfo("SetMaxVelocityMessage");
   add_messageinfo("SetEscapingMessage");
   add_messageinfo("SetSecurityDistanceMessage");
-  unsigned char tmp_hash[] = {0x90, 0x6b, 0x4d, 0xeb, 0x52, 0x4d, 0x53, 0x73, 0x4c, 0xbc, 0x82, 0x5, 0x80, 0x81, 0xf1, 0x39};
+  add_messageinfo("SetDriveModeMessage");
+  unsigned char tmp_hash[] = {0xfb, 0xb8, 0x77, 0x94, 0x41, 0xdb, 0x47, 0xaf, 0xb3, 0xbe, 0x56, 0x14, 0x1f, 0x49, 0x77, 0x7f};
   set_hash(tmp_hash);
 }
 
@@ -112,6 +114,35 @@ NavigatorInterface::~NavigatorInterface()
 {
   free(data_ptr);
 }
+/** Convert DriveMode constant to string.
+ * @param value value to convert to string
+ * @return constant value as string.
+ */
+const char *
+NavigatorInterface::tostring_DriveMode(DriveMode value) const
+{
+  switch (value) {
+  case MovingNotAllowed: return "MovingNotAllowed";
+  case CarefulForward: return "CarefulForward";
+  case SlowForward: return "SlowForward";
+  case ModerateForward: return "ModerateForward";
+  case FastForward: return "FastForward";
+  case CarefulAllowBackward: return "CarefulAllowBackward";
+  case SlowAllowBackward: return "SlowAllowBackward";
+  case ModerateAllowBackward: return "ModerateAllowBackward";
+  case FastAllowBackward: return "FastAllowBackward";
+  case CarefulBackward: return "CarefulBackward";
+  case SlowBackward: return "SlowBackward";
+  case ModerateBackward: return "ModerateBackward";
+  case FastBackward: return "FastBackward";
+  case ESCAPE: return "ESCAPE";
+  case SlowDribbleBall: return "SlowDribbleBall";
+  case ModerateDribbleBall: return "ModerateDribbleBall";
+  case FastDribbleBall: return "FastDribbleBall";
+  case OVERRIDE: return "OVERRIDE";
+  default: return "UNKNOWN";
+  }
+}
 /* Methods */
 /** Get flags value.
  * Bit-wise combination of
@@ -534,6 +565,37 @@ NavigatorInterface::set_escaping_enabled(const bool new_escaping_enabled)
   data_changed = true;
 }
 
+/** Get drive_mode value.
+ * Current drive mode
+ * @return drive_mode value
+ */
+NavigatorInterface::DriveMode
+NavigatorInterface::drive_mode() const
+{
+  return (NavigatorInterface::DriveMode)data->drive_mode;
+}
+
+/** Get maximum length of drive_mode value.
+ * @return length of drive_mode value, can be length of the array or number of 
+ * maximum number of characters for a string
+ */
+size_t
+NavigatorInterface::maxlenof_drive_mode() const
+{
+  return 1;
+}
+
+/** Set drive_mode value.
+ * Current drive mode
+ * @param new_drive_mode new drive_mode value
+ */
+void
+NavigatorInterface::set_drive_mode(const DriveMode new_drive_mode)
+{
+  data->drive_mode = new_drive_mode;
+  data_changed = true;
+}
+
 /* =========== message create =========== */
 Message *
 NavigatorInterface::create_message(const char *type) const
@@ -558,6 +620,8 @@ NavigatorInterface::create_message(const char *type) const
     return new SetEscapingMessage();
   } else if ( strncmp("SetSecurityDistanceMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
     return new SetSecurityDistanceMessage();
+  } else if ( strncmp("SetDriveModeMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
+    return new SetDriveModeMessage();
   } else {
     throw UnknownTypeException("The given type '%s' does not match any known "
                                "message type for this interface type.", type);
@@ -582,6 +646,9 @@ NavigatorInterface::copy_values(const Interface *other)
 const char *
 NavigatorInterface::enum_tostring(const char *enumtype, int val) const
 {
+  if (strcmp(enumtype, "DriveMode") == 0) {
+    return tostring_DriveMode((DriveMode)val);
+  }
   throw UnknownTypeException("Unknown enum type %s", enumtype);
 }
 
@@ -1646,6 +1713,96 @@ NavigatorInterface::SetSecurityDistanceMessage::clone() const
 {
   return new NavigatorInterface::SetSecurityDistanceMessage(this);
 }
+/** @class NavigatorInterface::SetDriveModeMessage <interfaces/NavigatorInterface.h>
+ * SetDriveModeMessage Fawkes BlackBoard Interface Message.
+ * 
+    
+ */
+
+
+/** Constructor with initial values.
+ * @param ini_drive_mode initial value for drive_mode
+ */
+NavigatorInterface::SetDriveModeMessage::SetDriveModeMessage(const DriveMode ini_drive_mode) : Message("SetDriveModeMessage")
+{
+  data_size = sizeof(SetDriveModeMessage_data_t);
+  data_ptr  = malloc(data_size);
+  memset(data_ptr, 0, data_size);
+  data      = (SetDriveModeMessage_data_t *)data_ptr;
+  data_ts   = (message_data_ts_t *)data_ptr;
+  data->drive_mode = ini_drive_mode;
+  add_fieldinfo(IFT_ENUM, "drive_mode", 1, &data->drive_mode, "DriveMode");
+}
+/** Constructor */
+NavigatorInterface::SetDriveModeMessage::SetDriveModeMessage() : Message("SetDriveModeMessage")
+{
+  data_size = sizeof(SetDriveModeMessage_data_t);
+  data_ptr  = malloc(data_size);
+  memset(data_ptr, 0, data_size);
+  data      = (SetDriveModeMessage_data_t *)data_ptr;
+  data_ts   = (message_data_ts_t *)data_ptr;
+  add_fieldinfo(IFT_ENUM, "drive_mode", 1, &data->drive_mode, "DriveMode");
+}
+
+/** Destructor */
+NavigatorInterface::SetDriveModeMessage::~SetDriveModeMessage()
+{
+  free(data_ptr);
+}
+
+/** Copy constructor.
+ * @param m message to copy from
+ */
+NavigatorInterface::SetDriveModeMessage::SetDriveModeMessage(const SetDriveModeMessage *m) : Message("SetDriveModeMessage")
+{
+  data_size = m->data_size;
+  data_ptr  = malloc(data_size);
+  memcpy(data_ptr, m->data_ptr, data_size);
+  data      = (SetDriveModeMessage_data_t *)data_ptr;
+  data_ts   = (message_data_ts_t *)data_ptr;
+}
+
+/* Methods */
+/** Get drive_mode value.
+ * Current drive mode
+ * @return drive_mode value
+ */
+NavigatorInterface::DriveMode
+NavigatorInterface::SetDriveModeMessage::drive_mode() const
+{
+  return (NavigatorInterface::DriveMode)data->drive_mode;
+}
+
+/** Get maximum length of drive_mode value.
+ * @return length of drive_mode value, can be length of the array or number of 
+ * maximum number of characters for a string
+ */
+size_t
+NavigatorInterface::SetDriveModeMessage::maxlenof_drive_mode() const
+{
+  return 1;
+}
+
+/** Set drive_mode value.
+ * Current drive mode
+ * @param new_drive_mode new drive_mode value
+ */
+void
+NavigatorInterface::SetDriveModeMessage::set_drive_mode(const DriveMode new_drive_mode)
+{
+  data->drive_mode = new_drive_mode;
+}
+
+/** Clone this message.
+ * Produces a message of the same type as this message and copies the
+ * data to the new message.
+ * @return clone of this message
+ */
+Message *
+NavigatorInterface::SetDriveModeMessage::clone() const
+{
+  return new NavigatorInterface::SetDriveModeMessage(this);
+}
 /** Check if message is valid and can be enqueued.
  * @param message Message to check
  * @return true if the message is valid, false otherwise.
@@ -1693,6 +1850,10 @@ NavigatorInterface::message_valid(const Message *message) const
   if ( m9 != NULL ) {
     return true;
   }
+  const SetDriveModeMessage *m10 = dynamic_cast<const SetDriveModeMessage *>(message);
+  if ( m10 != NULL ) {
+    return true;
+  }
   return false;
 }
 
diff --git a/src/libs/interfaces/NavigatorInterface.h b/src/libs/interfaces/NavigatorInterface.h
index f787461..8271dd8 100644
--- a/src/libs/interfaces/NavigatorInterface.h
+++ b/src/libs/interfaces/NavigatorInterface.h
@@ -49,6 +49,29 @@ class NavigatorInterface : public Interface
   static const uint32_t FLAG_SECURITY_DISTANCE;
   static const uint32_t FLAG_ESCAPING;
 
+  /** Drive modes enum */
+  typedef enum {
+    MovingNotAllowed /**< Moving not allowed constant */,
+    CarefulForward /**< Moving careful forward constant */,
+    SlowForward /**< Moving slow forward constant */,
+    ModerateForward /**< Moving moderate forward constant */,
+    FastForward /**< Moving fast forward constant */,
+    CarefulAllowBackward /**< Moving careful allow backward conatant */,
+    SlowAllowBackward /**< Moving slow allow backward constant */,
+    ModerateAllowBackward /**< Moving moderate allow backward constant */,
+    FastAllowBackward /**< Moving fast allow backward constant */,
+    CarefulBackward /**< Moving careful backward constant */,
+    SlowBackward /**< Moving slow backward constant */,
+    ModerateBackward /**< Moving moderate backward constant */,
+    FastBackward /**< Moving fast backward constant */,
+    ESCAPE /**< Escape constant */,
+    SlowDribbleBall /**< Moving slow dribble ball constant */,
+    ModerateDribbleBall /**< Moving moderate dribble ball constant */,
+    FastDribbleBall /**< Moving fast dribble ball constant */,
+    OVERRIDE /**< Override constant */
+  } DriveMode;
+  const char * tostring_DriveMode(DriveMode value) const;
+
  private:
 #pragma pack(push,4)
   /** Internal data storage, do NOT modify! */
@@ -77,6 +100,7 @@ class NavigatorInterface : public Interface
 	navigation components with integrated collision avoidance, to
 	check whether the navigator should stop when an obstacle
 	obstructs the path, or if it should escape. */
+    int32_t drive_mode; /**< Current drive mode */
   } NavigatorInterface_data_t;
 #pragma pack(pop)
 
@@ -377,6 +401,33 @@ class NavigatorInterface : public Interface
     virtual Message * clone() const;
   };
 
+  class SetDriveModeMessage : public Message
+  {
+   private:
+#pragma pack(push,4)
+    /** Internal data storage, do NOT modify! */
+    typedef struct {
+      int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
+      int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
+      int32_t drive_mode; /**< Current drive mode */
+    } SetDriveModeMessage_data_t;
+#pragma pack(pop)
+
+    SetDriveModeMessage_data_t *data;
+
+   public:
+    SetDriveModeMessage(const DriveMode ini_drive_mode);
+    SetDriveModeMessage();
+    ~SetDriveModeMessage();
+
+    SetDriveModeMessage(const SetDriveModeMessage *m);
+    /* Methods */
+    DriveMode drive_mode() const;
+    void set_drive_mode(const DriveMode new_drive_mode);
+    size_t maxlenof_drive_mode() const;
+    virtual Message * clone() const;
+  };
+
   virtual bool message_valid(const Message *message) const;
  private:
   NavigatorInterface();
@@ -423,6 +474,9 @@ class NavigatorInterface : public Interface
   bool is_escaping_enabled() const;
   void set_escaping_enabled(const bool new_escaping_enabled);
   size_t maxlenof_escaping_enabled() const;
+  DriveMode drive_mode() const;
+  void set_drive_mode(const DriveMode new_drive_mode);
+  size_t maxlenof_drive_mode() const;
   virtual Message * create_message(const char *type) const;
 
   virtual void copy_values(const Interface *other);
diff --git a/src/libs/interfaces/NavigatorInterface.tolua b/src/libs/interfaces/NavigatorInterface.tolua
index 3e6a464..07afa45 100644
--- a/src/libs/interfaces/NavigatorInterface.tolua
+++ b/src/libs/interfaces/NavigatorInterface.tolua
@@ -15,6 +15,27 @@ class NavigatorInterface : public Interface
   static const unsigned int FLAG_SECURITY_DISTANCE;
   static const unsigned int FLAG_ESCAPING;
 
+  typedef enum {
+    MovingNotAllowed,
+    CarefulForward,
+    SlowForward,
+    ModerateForward,
+    FastForward,
+    CarefulAllowBackward,
+    SlowAllowBackward,
+    ModerateAllowBackward,
+    FastAllowBackward,
+    CarefulBackward,
+    SlowBackward,
+    ModerateBackward,
+    FastBackward,
+    ESCAPE,
+    SlowDribbleBall,
+    ModerateDribbleBall,
+    FastDribbleBall,
+    OVERRIDE
+  } DriveMode;
+
   class StopMessage : public Message
   {
     StopMessage();
@@ -138,6 +159,17 @@ class NavigatorInterface : public Interface
     int maxlenof_security_distance() const;
   };
 
+  class SetDriveModeMessage : public Message
+  {
+    SetDriveModeMessage(DriveMode ini_drive_mode);
+    SetDriveModeMessage();
+    ~SetDriveModeMessage();
+
+    DriveMode drive_mode();
+    void set_drive_mode(const DriveMode new_drive_mode);
+    int maxlenof_drive_mode() const;
+  };
+
   unsigned int flags();
   void set_flags(const unsigned int new_flags);
   int maxlenof_flags() const;
@@ -177,6 +209,9 @@ class NavigatorInterface : public Interface
   bool is_escaping_enabled();
   void set_escaping_enabled(const bool new_escaping_enabled);
   int maxlenof_escaping_enabled() const;
+  DriveMode drive_mode();
+  void set_drive_mode(const DriveMode new_drive_mode);
+  int maxlenof_drive_mode() const;
   bool                    oftype(const char *interface_type) const;
   const void *            datachunk() const;
   unsigned int            datasize() const;
diff --git a/src/libs/interfaces/NavigatorInterface.xml b/src/libs/interfaces/NavigatorInterface.xml
index 9701dee..aff31f9 100644
--- a/src/libs/interfaces/NavigatorInterface.xml
+++ b/src/libs/interfaces/NavigatorInterface.xml
@@ -38,6 +38,27 @@
     <constant type="uint32" value="32" name="FLAG_ESCAPING">
       Navigator component supports escaping which can be enabled and disabled.
     </constant>
+   <enum name="DriveMode">
+     <comment>Drive modes enum</comment>
+     <item name="MovingNotAllowed">Moving not allowed constant</item>
+     <item name="CarefulForward">Moving careful forward constant</item>
+     <item name="SlowForward">Moving slow forward constant</item>
+     <item name="ModerateForward">Moving moderate forward constant</item>
+     <item name="FastForward">Moving fast forward constant</item>
+     <item name="CarefulAllowBackward">Moving careful allow backward conatant</item>
+     <item name="SlowAllowBackward">Moving slow allow backward constant</item>
+     <item name="ModerateAllowBackward">Moving moderate allow backward constant</item>
+     <item name="FastAllowBackward">Moving fast allow backward constant</item>
+     <item name="CarefulBackward">Moving careful backward constant</item>
+     <item name="SlowBackward">Moving slow backward constant</item>
+     <item name="ModerateBackward">Moving moderate backward constant</item>
+     <item name="FastBackward">Moving fast backward constant</item>
+     <item name="ESCAPE">Escape constant</item>
+     <item name="SlowDribbleBall">Moving slow dribble ball constant</item>
+     <item name="ModerateDribbleBall">Moving moderate dribble ball constant</item>
+     <item name="FastDribbleBall">Moving fast dribble ball constant</item>
+     <item name="OVERRIDE">Override constant</item>
+  </enum>
   </constants>
   <data>
     <comment>
@@ -81,6 +102,9 @@
 	navigation components with integrated collision avoidance, to
 	check whether the navigator should stop when an obstacle
 	obstructs the path, or if it should escape.</field>
+
+    <field type="DriveMode" name="drive_mode">Current drive mode</field>
+  
   </data>
   <message name="Stop">
     <comment>Stop motion immediately.</comment>
@@ -131,4 +155,8 @@
     collision avoidance.</comment>
     <ref>security_distance</ref>
   </message>
+  <message name="SetDriveModeMessage">
+    <comment>Sets the desired drive modefor collision avoidance.</comment>
+    <ref>drive_mode</ref>
+  </message>
 </interface>




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list