Scott Xmiles / DynamixelAX12

Files at this revision

API Documentation at this revision

Comitter:
deoryp
Date:
Fri Apr 02 23:51:11 2010 +0000
Commit message:

Changed in this revision

AX12.cpp Show annotated file Show diff for this revision Revisions of this file
AX12.h Show annotated file Show diff for this revision Revisions of this file
MotorBusManager.cpp Show annotated file Show diff for this revision Revisions of this file
MotorBusManager.h Show annotated file Show diff for this revision Revisions of this file
ax12_defines.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AX12.cpp	Fri Apr 02 23:51:11 2010 +0000
@@ -0,0 +1,13 @@
+#include "AX12.h"
+
+AX12::AX12(int id) {
+    _id = id;
+}
+
+int AX12::getId() {
+    return _id;
+}
+
+void AX12::setId(int id) {
+    _id = id;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AX12.h	Fri Apr 02 23:51:11 2010 +0000
@@ -0,0 +1,35 @@
+/*
+  ax12.h - arbotiX Library for AX-12 Servos
+  Copyright (c) 2008,2009 Michael E. Ferguson.  All right reserved.
+    Modifed by Scott Nichols, 2010
+    
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library 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
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef AX12_h
+#define AX12_h
+
+class AX12 {
+    public:
+        AX12(int id);
+        int getId();
+        void setId(int id);
+          
+    private:
+        int _id;
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MotorBusManager.cpp	Fri Apr 02 23:51:11 2010 +0000
@@ -0,0 +1,25 @@
+
+#include "MotorBusManager.h"
+
+
+MotorBusManager::MotorBusManager(long baud) {
+    nextMotorIndex = 0;
+}
+
+int MotorBusManager::addMotor(int id) {
+    if (nextMotorIndex >= MAX_MOTORS) {
+        return -1;
+    }
+    AX12 newMotor = new AX12(id);
+    motorBus[nextMotorIndex] = &newMotor;
+    nextMotorIndex++;
+    return nextMotorIndex-1;
+}
+
+int MotorBusManager::getRegister(int index, int regstart, int length) {
+    return -1;
+}
+
+void MotorBusManager::setRegister(int index, int regstart, int data) {
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MotorBusManager.h	Fri Apr 02 23:51:11 2010 +0000
@@ -0,0 +1,20 @@
+#ifndef __motor_bus_manager_h
+#define __motor_bus_manager_h
+
+#include "AX12.h"
+
+#define MAX_MOTORS 2
+
+class MotorBusManager {
+    public:
+        MotorBusManager(long baud);
+        int  addMotor(int id);
+        int  getRegister(int index, int regstart, int length);
+        void setRegister(int index, int regstart, int data);
+        
+    private:
+        int nextMotorIndex;
+        AX12* motorBus[MAX_MOTORS];
+}
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ax12_defines.h	Fri Apr 02 23:51:11 2010 +0000
@@ -0,0 +1,89 @@
+/*
+  ax12.h - arbotiX Library for AX-12 Servos
+  Copyright (c) 2008,2009 Michael E. Ferguson.  All right reserved.
+    Modifed by Scott Nichols, 2010
+    
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library 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
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef __ax12_defines_h
+#define __ax12_defines_h
+
+/** EEPROM AREA **/
+#define AX_MODEL_NUMBER_L           0
+#define AX_MODEL_NUMBER_H           1
+#define AX_VERSION                  2
+#define AX_ID                       3
+#define AX_BAUD_RATE                4
+#define AX_RETURN_DELAY_TIME        5
+#define AX_CW_ANGLE_LIMIT_L         6
+#define AX_CW_ANGLE_LIMIT_H         7
+#define AX_CCW_ANGLE_LIMIT_L        8
+#define AX_CCW_ANGLE_LIMIT_H        9
+#define AX_SYSTEM_DATA2             10
+#define AX_LIMIT_TEMPERATURE        11
+#define AX_DOWN_LIMIT_VOLTAGE       12
+#define AX_UP_LIMIT_VOLTAGE         13
+#define AX_MAX_TORQUE_L             14
+#define AX_MAX_TORQUE_H             15
+#define AX_RETURN_LEVEL             16
+#define AX_ALARM_LED                17
+#define AX_ALARM_SHUTDOWN           18
+#define AX_OPERATING_MODE           19
+#define AX_DOWN_CALIBRATION_L       20
+#define AX_DOWN_CALIBRATION_H       21
+#define AX_UP_CALIBRATION_L         22
+#define AX_UP_CALIBRATION_H         23
+/** RAM AREA **/
+#define AX_TORQUE_ENABLE            24
+#define AX_LED                      25
+#define AX_CW_COMPLIANCE_MARGIN     26
+#define AX_CCW_COMPLIANCE_MARGIN    27
+#define AX_CW_COMPLIANCE_SLOPE      28
+#define AX_CCW_COMPLIANCE_SLOPE     29
+#define AX_GOAL_POSITION_L          30
+#define AX_GOAL_POSITION_H          31
+#define AX_GOAL_SPEED_L             32
+#define AX_GOAL_SPEED_H             33
+#define AX_TORQUE_LIMIT_L           34
+#define AX_TORQUE_LIMIT_H           35
+#define AX_PRESENT_POSITION_L       36
+#define AX_PRESENT_POSITION_H       37
+#define AX_PRESENT_SPEED_L          38
+#define AX_PRESENT_SPEED_H          39
+#define AX_PRESENT_LOAD_L           40
+#define AX_PRESENT_LOAD_H           41
+#define AX_PRESENT_VOLTAGE          42
+#define AX_PRESENT_TEMPERATURE      43
+#define AX_REGISTERED_INSTRUCTION   44
+#define AX_PAUSE_TIME               45
+#define AX_MOVING                   46
+#define AX_LOCK                     47
+#define AX_PUNCH_L                  48
+#define AX_PUNCH_H                  49
+/** Status Return Levels **/
+#define AX_RETURN_NONE              0
+#define AX_RETURN_READ              1
+#define AX_RETURN_ALL               2
+/** Instruction Set **/
+#define AX_PING                     1
+#define AX_READ_DATA                2
+#define AX_WRITE_DATA               3
+#define AX_REG_WRITE                4
+#define AX_ACTION                   5
+#define AX_RESET                    6
+#define AX_SYNC_WRITE               131
+
+#endif