Commit e1b920ef authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Updated to version 2 of the dynamixel protocol.

Updated to the new version of the dynamixel library.
parent fa01a342
......@@ -6,11 +6,11 @@
CBattery_Charger::CBattery_Charger(std::string& battery_id,unsigned char bus_id,int baudrate,unsigned char dev_id)
{
this->dyn_server=CDynamixelServer::instance();
this->dyn_server=CDynamixelServerFTDI::instance();
this->dyn_device=NULL;
try{
this->dyn_server->config_bus(bus_id,baudrate);
this->dyn_device=this->dyn_server->get_device(dev_id);
this->dyn_device=this->dyn_server->get_device(dev_id,dyn_version2);
this->battery_id=battery_id;
}catch(CException &e){
/* handle exceptions */
......@@ -23,11 +23,11 @@ CBattery_Charger::CBattery_Charger(std::string& battery_id,unsigned char bus_id,
CBattery_Charger::CBattery_Charger(std::string& battery_id,std::string& bus_id,int baudrate,unsigned char dev_id)
{
this->dyn_server=CDynamixelServer::instance();
this->dyn_server=CDynamixelServerFTDI::instance();
this->dyn_device=NULL;
try{
this->dyn_server->config_bus(bus_id,baudrate);
this->dyn_device=this->dyn_server->get_device(dev_id);
this->dyn_device=this->dyn_server->get_device(dev_id,dyn_version2);
this->battery_id=battery_id;
}catch(CException &e){
/* handle exceptions */
......
#ifndef _BATTERY_CHARGER_H
#define _BATTERY_CHARGER_H
#include "dynamixelserver.h"
#include "dynamixelserver_ftdi.h"
#include "dynamixel.h"
#include "threadserver.h"
#include "eventserver.h"
......@@ -38,7 +38,7 @@ class CBattery_Charger
{
private:
std::string battery_id;
CDynamixelServer *dyn_server;
CDynamixelServerFTDI *dyn_server;
CDynamixel *dyn_device;
protected:
void check_model(void);
......
......@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
int i=0;
try{
CBattery_Charger battery(battery_name,battery_serial,57600,0xC0);
CBattery_Charger battery(battery_name,battery_serial,1000000,0xC0);
battery.get_buzzer_config(&buzzer);
std::cout << "Buzzer frequency: " << buzzer.freq_hz << " Hz" << std::endl;
std::cout << "Buzzer time on: " << buzzer.time_on_s << " s" << std::endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment