Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My implementations
10-08-2015, 06:48 PM
Post: #11
RE: My implementations
(10-08-2015 03:25 PM)vlelectronic Wrote:  How does your robot to balance with the weight, I did not succeed, can you explain?
For now this is only test version.
//stepCounter - on disbalance counts motor steps from neutral position
//stepCounterSaved - stepCounter previous value. currently correction saving is only when throttle == 0
angle_adjusted = dmpGetPhi() - stepCounter*0.01 - stepCounterSaved;
Find all posts by this user
Quote this message in a reply
10-08-2015, 07:39 PM (This post was last modified: 10-08-2015 07:43 PM by KomX.)
Post: #12
RE: My implementations
(10-08-2015 06:48 PM)sasa999 Wrote:  For now this is only test version.
//stepCounter - on disbalance counts motor steps from neutral position
//stepCounterSaved - stepCounter previous value. currently correction saving is only when throttle == 0
angle_adjusted = dmpGetPhi() - stepCounter*0.01 - stepCounterSaved;

RU:
Час от часу, не легче. Объясните Вы точно, где вводите переменные, какие начальные значения, где меняете эти значения и почему? Какую цель преследовали и вообще ближе к скетчу. Smile
Согласитесь, Ваша реплика ясности не привнесла...
Дайте больше информации и Ваш робот будет брать в холодильнике пиво и относить Вам.

EN by Google:
Hour by hour, not easier. Explain that you are exactly where to enter variables have initial values, where the values are changing and why? What is the goal pursued and even closer to the sketch. Smile
Agree, Your remark is not brought clarity ...
Give more information and your robot will take a beer in the fridge and treat you.
Find all posts by this user
Quote this message in a reply
10-08-2015, 08:58 PM (This post was last modified: 10-08-2015 09:05 PM by sasa999.)
Post: #13
RE: My implementations
(10-08-2015 07:39 PM)KomX Wrote:  ...Объясните Вы точно, где вводите переменные, какие начальные значения, где меняете эти значения и почему? Какую цель преследовали и вообще ближе к скетчу...
bool angleSaved = 0;
int cntM1 = 0;
int cntM2 = 0;
int stepCounter = 0;
int stepCounterSaved = 0;
Code:
ISR(TIMER1_COMPA_vect)                   // прерывание наступает по истечении времени между импульсами step управления шаговым мотором 1
{
  if (dir_M1 == 0)                       // Если нет движения шаговый импульс не генерировать
    return;
  if (dir_M1 > 0)
  {
    cntM1++;
    SET(PORTC, 6);                       // DIR Motors (Forward for Motor1)
  }
  else
  {
    cntM1--;
    CLR(PORTC, 6);                       // DIR Motors (Revers for Motor1)
  }
  OCR1A  = OCR1A + period_M1;
  __asm__ __volatile__ (
    "nop" "\n\t"
    "nop" "\n\t"
    "nop" "\n\t"
    "nop" "\n\t"
    "nop");
  SET(PORTE, 6);                         // STEP MOTOR 1 (см. таблицу в начале для PINOUT D7)
  delay_1us();
  CLR(PORTE, 6);
}

то же самое для второго мотора

in void loop()
Code:
angle_adjusted = dmpGetPhi() - stepCounter*0.01 - stepCounterSaved*0.01;

Code:
stepCounter = (cntM1 + cntM2)/2;
  if (throttle != 0 )
  {
    if (!angleSaved)
    {
      stepCounterSaved = stepCounter;
      angleSaved = 1;
    }
    cntM1 = 0;
    cntM2 = 0;
  }
  else angleSaved = 0;

Код совсем сырой - это пока только наброски идеи. Ещё надо добавить - усреднение параметров stepCounter и angle_adjusted за последние 0.2-0.5с-1с. Иначе при среднем и быстром движении робот становится нестабильным.
Find all posts by this user
Quote this message in a reply
10-09-2015, 06:21 PM
Post: #14
RE: My implementations
Hello Sasa,
I can not compile the code, where period_M1 testify?
Can you send a file to .ino: vlelectroniclab@gmail.com
I have another problem, the slides in touch osc not automatically return to zero solution that give me? I use RN-171
Thank you
greetings VL
Find all posts by this user
Quote this message in a reply
10-09-2015, 11:28 PM
Post: #15
RE: My implementations
(10-09-2015 06:21 PM)vlelectronic Wrote:  I can not compile the code, where period_M1 testify?
uint16_t period_M1, period_M2
Hardware part of code is different and it has different pinout too. You can't put on B-robot brainshield.
Written by KomX look at this http://forumsjjrobots.com/thread-43.html
Find all posts by this user
Quote this message in a reply
10-10-2015, 06:27 AM
Post: #16
RE: My implementations
Hi, vlelectronic.
I see you have questions for the code to adapt the board Sparkfun Pro Micro (different size and pin count of Leonardo).
If you use the card Pro Micro, I will be glad to discuss these or other problems. 
If you are using a Leonardo, is to teach the robot new balancing algorithm, you need only to add counters to the subprogram generating motor control signals and ignore variables that are designed to ensure the engine is running at a different algorithm and hardware support.
Find all posts by this user
Quote this message in a reply
10-13-2015, 12:20 PM
Post: #17
RE: My implementations
Hello KomX,
I bought Arduino micro pro, esp12e, a4988 and MPU6050.
I intension to build a new robot.
Advise me to put in the imu as Brobot or main mainboard? I recommend using lipo 3s 1s or with step-up?
I wish that the robot is always in equilibrium by adding weights.
You can see the battery voltage on smartphones?
regards Vito
Find all posts by this user
Quote this message in a reply
10-13-2015, 01:16 PM
Post: #18
RE: My implementations
Hi, Vito.

(10-13-2015 12:20 PM)vlelectronic Wrote:  I bought Arduino micro pro, esp12e, a4988 and MPU6050.
I intension to build a new robot.

By selecting this configuration, you will need to use the modified code. Please look at these messages. If you're interested, I'll be a slave to answer your questions in that topic.

Quote:Advise me to put in the imu as Brobot or main mainboard? I recommend using lipo 3s 1s or with step-up?

The first question is not understood. Try to extend it.
In the matter of configuring the batteries is difficult to advise anything. It is cheaper to use a 3S battery and lowering the voltage integrated circuits. In this case, however, it needs to control the voltage on all three battery banks separately. If you choose this option will write the code maintenance. A more expensive option offered sasa999 (see post).
I use a 3.7 volt battery on and DC/DC converters (1 UP & 2 DOWN).
In this case it is easier to charge (using a charger 5V, 2A) and there is no need to equalize the charge in the battery banks.

Quote:I wish that the robot is always in equilibrium by adding weights.

As I know, sasa999 proposed changes to the code to allow the robot to balance the additional weight, but only in stop mode. I think that the author of this idea and implements it in motion.

Quote:You can see the battery voltage on smartphones?

Similarly above. The finished work is the implementation of two-way communication with a smartphone I have not seen. Some developments have sasa999. As seems to me, is the level of control on the smartphone battery can be realized with colored "LED".

Regards, Oleg.
Find all posts by this user
Quote this message in a reply
10-13-2015, 01:27 PM
Post: #19
RE: My implementations
Hello KomX,

"Advise me to put in the eu as A robot or main board?"

I mean that it is better to put the imu away from the engines or mount it in Brobot original?
Sorry but I use a translator!
regards Vito
Find all posts by this user
Quote this message in a reply
10-13-2015, 01:44 PM
Post: #20
RE: My implementations
(10-13-2015 01:27 PM)vlelectronic Wrote:  I mean that it is better to put the imu away from the engines or mount it in Brobot original?

Since we do not use acceleration, but only a change in the angle, the position sensor is not critical. You can put anywhere.

Quote:Sorry but I use a translator!

I also use a Russian translator.Angel
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)