4WD Hercules Mobile Robotic Platform

Hello , I buy yesterday the Hercule platform mobile , but the program does not walk . Someome a would a new program which would walk with a remote control ?

seeedstudio.com/wiki/Hercules_Du … pand_Usage

sorry on my english , i’am french :confused:

hi, I am the designer of hercule :laughing: . I need more details about your problem, would you please talk more about what happens ?

Hello!
I bought Hercules Mobile Platform. I want to know:

  1. encoder model or resolution of encoder (clicks per revolution of wheel).
  2. Can I determine the rotation direction with this encoder?

Hello the designer of hercule , this is fantastic chassie and very god job :slight_smile: , I do not understand how it works , let me explain by drawing

for the 1 this code is ?

[code]// demo of rfbee send and recv
// loovee 2013
#include <Arduino.h>
#include <EEPROM.h>
#include <RFBeeSendRev.h>
#include <RFBeeCore.h>

unsigned char dtaUart[100]; // serial data buf
unsigned char dtaUartLen = 0; // serial data length

/*********************************************************************************************************
** Function name: setup
** Descriptions: setup
*********************************************************************************************************/
void setup(){

pinMode(10, OUTPUT);
RFBEE.init();
Serial.begin(38400);
Serial.println("ok");

}

unsigned char rxData1[200]; // data len
unsigned char len1; // len
unsigned char srcAddress1;
unsigned char destAddress1;
char rssi1;
unsigned char lqi1;
int result1;

unsigned char cntGetDta = 5;

/*********************************************************************************************************
** Function name: loop
** Descriptions: loop
*********************************************************************************************************/
void loop()
{
if(RFBEE.isDta()) // rfbee get data
{
result1 = receiveData(rxData1, &len1, &srcAddress1, &destAddress1, (unsigned char *)&rssi1 , &lqi1);
for(int i = 0; i< len1; i++)
{
Serial.print(rxData1[i]);
}
}

if(dtaUartLen)                          // serial get data
{
    RFBEE.sendDta(dtaUartLen, dtaUart);
    dtaUartLen = 0;
}

}

void serialEvent()
{
while (Serial.available())
{
dtaUart[dtaUartLen++] = (unsigned char)Serial.read();
}

}

/*********************************************************************************************************
END FILE
*********************************************************************************************************/[/code]

for the 2 this code is ?

[code]// demo of rfbee send and recv
#include <Arduino.h>
#include <EEPROM.h>
#include <RFBeeSendRev.h>
#include <RFBeeCore.h>
#include <Sleep_n0m1.h>
#include <Power.h>
#include <Sleep_n0m1.h>
#include <TimerOne.h>

#define FRAMESTART1 0x53 // data frame start1
#define FRAMESTART2 0x01 // data frame start2
#define FRAMEEND1 0x2f // data frame end1
#define FRAMEEND2 0x45 // data frame end2

#define __DebugRf 0
#define HTCHECK 1

#if __DebugRf
#define __print(X) Serial.print(X)
#define __println(X) Serial.println(X)
#else
#define __print(X)
#define __println(X)
#endif

#define SPICSHIGH() digitalWrite(10, HIGH)
#define SPICSLOW() digitalWrite(10, LOW)

unsigned char dtaUart[100];
unsigned char dtaUartLen = 0;
bool stringComplete = false; // if get data

Sleep sleep;

/*********************************************************************************************************
** Function name: pwrDown
** Descriptions: power down mode, for tSleep ms
*********************************************************************************************************/
void pwrDown(unsigned long tSleep)
{
unsigned char regTmp;
CCx.Read(0x18, &regTmp);
CCx.Write(0x18, regTmp|0x01);
CCx.Strobe(CCx_SIDLE); // IDLE
CCx.Strobe(CCx_SFRX); // Flush RX buffer
CCx.Strobe(CCx_SPWD); // Standby
SPICSHIGH();
power_adc_disable();
power_twi_disable();
sleep.pwrDownMode(); //set sleep mode
sleep.sleepDelay(tSleep); //sleep for: sleepTime
}

/*********************************************************************************************************
** Function name: wakeUp
** Descriptions: wake up
*********************************************************************************************************/
void wakeUp()
{
power_adc_enable();
power_twi_enable();
SPICSLOW();
RFBEE.init();
}

/*********************************************************************************************************
** Function name: checkGoodDta
** Descriptions: if uart get good data
*********************************************************************************************************/
unsigned char checkGoodDta(unsigned char *dta)
{
#if HTCHECK

__println("BEGIN TO CHECK GOOD DATA!!");

for(int i = 0; i < dtaUartLen; i++)
{
    __print(dta[i]);
    __print("\t");
}
__println();

int ioffset = 0;

for(ioffset = 0; ioffset < dtaUartLen; ioffset++)
{
    if(dta[ioffset] == FRAMESTART1 && dta[ioffset+1] == FRAMESTART2)
    {
        break;
    }
}

if(dtaUartLen - ioffset < 6)
{
    __println("get bad data");
    return 0;
}

dtaUartLen -= ioffset;

//dta = &dta[ioffset];

for(int i = 0; ;i++)
{
    dta[i] = dta[i+ioffset];
    __print(dta[i]);
    __print("\t");
    if(dta[i-1] == FRAMEEND1 && dta[i] == FRAMEEND2)
    {
        break;
    }
}
__println();
__println("get good data");

return dtaUartLen;

#else
return 1;
#endif
}

unsigned char isSleep()
{
if(dtaUart[2] == 0x55 && dtaUart[3] == 0x55 && dtaUart[4] == 0x55)
{
__print("ATSLEEP: ");
__println(900);
#if __DebugRf
delay(20);
#endif
pwrDown(900);
wakeUp();
__println(“awake”);
return 1;
}
return 0;
}
/*********************************************************************************************************
** Function name: setup
** Descriptions: setup
*********************************************************************************************************/
void setup(){

pinMode(10, OUTPUT);
RFBEE.init();
Serial.begin(38400);
Serial.println("ok");

}

unsigned char rxData1[200]; // data len
unsigned char len1; // len
unsigned char srcAddress1;
unsigned char destAddress1;
char rssi1;
unsigned char lqi1;
int result1;

unsigned char cntGetDta = 5;

/*********************************************************************************************************
** Function name: loop
** Descriptions: loop
*********************************************************************************************************/
void loop()
{
if(RFBEE.isDta())
{
result1 = receiveData(rxData1, &len1, &srcAddress1, &destAddress1, (unsigned char *)&rssi1 , &lqi1);
for(int i = 0; i< len1; i++)
{
Serial.write(rxData1[i]);
}
}

#if HTCHECK
if(stringComplete)
{

    if(checkGoodDta(dtaUart))
    {

        if(isSleep() == 0)
        {
            RFBEE.sendDta(dtaUartLen, dtaUart);
        }
    }
    dtaUartLen      = 0;
    stringComplete  = 0;
}

#else
if(dtaUartLen)
{
if(isSleep() == 0)
{
RFBEE.sendDta(dtaUartLen, dtaUart);
}
dtaUartLen = 0;
}
#endif
}

void serialEvent()
{
#if HTCHECK
while (Serial.available())
{
dtaUart[dtaUartLen++] = (unsigned char)Serial.read();
if(dtaUart[dtaUartLen-1] == FRAMEEND2 && dtaUart[dtaUartLen-2] == FRAMEEND1)
{
stringComplete = 1;
}

    if(dtaUartLen > 80)
    {
        dtaUartLen      = 0;
        stringComplete  = 0;
    }
}

#else
while (Serial.available())
{
dtaUart[dtaUartLen++] = (unsigned char)Serial.read();
}
#endif
}

/*********************************************************************************************************
END FILE
*********************************************************************************************************/[/code]

and the 3 this code is ?

[code]/*
remote_lvc.ino
2013 Copyright © Seeed Technology Inc. All right reserved.

Author:Loovee
2013-3-18

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
*/

#include “moto_4wd.h”
#include <pwm_lvc.h>
#include <Wire.h>

bool flagGetI2C = 0;
unsigned char i2cDta[20];
unsigned char dtalen = 0;

unsigned char dirLeft = 0;
unsigned char dirRight = 0;
unsigned char speedLeft = 0;
unsigned char speedRight = 0;

/*********************************************************************************************************
** Function name: getAnalog
** Descriptions: read analog value
*********************************************************************************************************/
void setup()
{
MOTOR.init();
Serial.begin(38400);
Serial.println(“ok”);
Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
}

/*********************************************************************************************************
** Function name: getAnalog
** Descriptions: read analog value
*********************************************************************************************************/
void loop()
{
if(flagGetI2C)
{
flagGetI2C = 0;
dtalen = 0;
speedLeft = i2cDta[2];
speedRight = i2cDta[3];

	dirLeft  = speedLeft >= 0x80 ? DIRR : DIRF;
	dirRight = speedRight>= 0x80 ? DIRR : DIRF;
	
	dirRight = 1-dirRight;
	
	speedLeft  = speedLeft  & 0x7f;
	speedRight = speedRight & 0x7f;
	
    MOTOR.setSpeedDir1(speedLeft, dirLeft);
    MOTOR.setSpeedDir2(speedRight, dirRight);
    Serial.print("speed_left  = ");Serial.println(i2cDta[2]);
    Serial.print("speed_right = ");Serial.println(i2cDta[3]);
}

delay(1);

}

/*********************************************************************************************************
** Function name: getAnalog
** Descriptions: read analog value
/
void receiveEvent(int howMany)
{
while(0 < Wire.available()) // loop through all but the last
{
flagGetI2C = 1;
unsigned int c = Wire.read(); // receive byte as a character
Serial.print(c, DEC); // print the character
Serial.print("\t");
i2cDta[dtalen++] = c;
}
}
/

  • END FILE
    *********************************************************************************************************/

[/code]

my objective to understand your code and also run as chassie radio :slight_smile:
thank you creator :smiley:
IMG_0204-1-.JPG
Bee_Stem.jpg