Только вот, что-то у него не клеится всё никак, жалуется, что после включения робота, иногда серва, которая поворачивает камеру, начинает вращаться сама по себе в одну сторону.
Я сам с Arduino никогда дело не имел, так что сам ему помочь не смогу.
Он тут листинг управляющей программы прислал, которую он в Arduino прошивает.
Может кто-нибудь из форумчан сможет помочь разобраться в чёт тут дело?
Эх, очень уж хочется, что бы его трехколесный-бермудский «керогаз» уже поехал куда нужно, что бы и другие пользователи, воодушевлённые его примером, тоже бы подтягивались с установкой AVM Navigator на свои роботы.
HI EDV, thanks for the link, It is now installed in RR,
I have a new problem, everytime i plug in the USB to laptop, it keep restarting as the sparkfun also shows high delayed in pipeline, And the servo turret, keep rotating CW until the end and kept forcing the rotation even it is the extreme end, It goes to central after some time and repeated the error, As you can hear the rotation and see in the pipeline
I had been finding the cause of this error but i was not able, the problems existed inconsistency, sometimes the error dissappear itself after turret errornously move for few times but this time the problem happened nonstop, I have tried to do the following
1 upload the program to arduino 2. Shutdown the roborealm and plug in the usb to arduino 3.disactivate the turret What happen
1. Problem still exist 2when shutdown, the error solved, when plug jn the usb to arduino and in the sparkfun assign the port, the problem exist 3. Worked but when activate again, problem exist
Other observation: when the robot is powered with the batterry on. The robot move by itself and turret keep going clockwise non stop repeatedly
EDV писал(а):
You should specify some additional information regarding your Arduino controller so that we will be able to help with it:
1. What Arduino firmware version you use? 2. Which ports you use for servos connection? 3. How was implemented power supply of Arduino controller.
Please try to provide for us more detailed information for analysis.
bmw318be писал(а):
1 i am using arduino 0022 2 servo turret connection pin 9 and the port that i use is port 7 3. The power of the arduino is using batterry 12 V. And since the usb is connected the power 1st is through USB.
That is why we see the pipeline has high value and once i on the power in batterry, the robot sometimes moved by itself when it is im error stage
Is it info above sufficient
EDV писал(а):
The number 00022 is version of IDE that you use but we need in firmware program version number that you have uploaded/burned to Arduino controller.
If you use your own user-made arduino program then you should give us source code for analyses.
If you use already-made arduino program then you should give us link to the project where you have downloaded this firmware arduino program.
bmw318be писал(а):
Here is the code, Note:L the ultrasonic sensor, I did not use it, Hope you can have a good analysis
I think thats is the RR code, here is the arduino code:
Код:
ervo servos[12]; boolean pinModes[14];
unsigned int crc; unsigned int command; unsigned int channel; unsigned int value; unsigned int valueLow; unsigned int valueHigh; unsigned int streamDigital; unsigned int streamAnalog; unsigned int lastDigital; unsigned int lastAnalog[8];
void initializeAvmNav() { int i; for (i=2;i<14;i++) pinModes[i]=-1; streamDigital=0; streamAnalog=0; lastDigital=-1; for (i=0;i<8;i++) lastAnalog[i]=-1; }
void readPacketAvmNav() { // get header byte // 128 (bit 8) flag indicates a new command packet .. that // means the value bytes can never have 128 set! // next byte is the command 0-8 // next byte is the channel 0-16
do { while (Serial.available() <= 0) continue; command = Serial.read(); } while ((command&128)==0);
command^=128;
while (Serial.available() <= 0) continue; channel = Serial.read(); }
int readValuePacketAvmNav() { unsigned int valueLow; unsigned int valueHigh;
// wait for value low byte while (Serial.available() <= 0) continue; valueLow = Serial.read(); if (valueLow&128) return 0;
// wait for value high byte while (Serial.available() <= 0) continue; valueHigh = Serial.read(); if (valueHigh&128) return 0;
// wait for crc byte while (Serial.available() <= 0) continue; crc = Serial.read(); if (crc&128) return 0;
if (crc!=(((128|command)^channel^valueLow^valueHigh)&127)) return 0;
***************************************************************/ void setup() { //setup communication with roborealm PC Serial.begin(115200); initializeAvmNav(); //setup for ultraSoundSignal //pinMode(ultraSoundSignal, OUTPUT); // sets enable as output }
void loop() { //distCalc(); //delay(40); while (Serial.available()>0) { readPacketAvmNav();
switch (command) { // init case ARDUINO_GET_ID: initializeAvmNav(); Serial.print("ARDU"); break; // servo case ARDUINO_SET_SERVO: if ((channel>=3)&&(channel<=11)) { if (readValuePacketAvmNav()) { if (pinModes[channel]!=1) { servos[channel].attach(channel); pinModes[channel]=1; } servos[channel].writeMicroseconds(value); writeValuePacketAvmNav(value); } } break; //digital stream case ARDUINO_SET_DIGITAL_STREAM: if (readValuePacketAvmNav()) { streamDigital = value; writeValuePacketAvmNav(value); lastDigital=-1; } break; //set digital high case ARDUINO_SET_DIGITAL_HIGH: if ((channel>=2)&&(channel<14)) { if (pinModes[channel]!=2) { if (pinModes[channel]==1) servos[channel].detach();
pinMode(channel, OUTPUT); pinModes[channel]=2; if (streamDigital&(1<<channel)) streamDigital^=1<<channel; }
digitalWrite(channel, HIGH); writePacketAvmNav(); } break; //set digital low case ARDUINO_SET_DIGITAL_LOW: if ((channel>=2)&&(channel<14)) { if (pinModes[channel]!=2) { if (pinModes[channel]==1) servos[channel].detach();
pinMode(channel, OUTPUT); pinModes[channel]=2;
if (streamDigital&(1<<channel)) streamDigital^=1<<channel; } digitalWrite(channel, LOW); writePacketAvmNav(); } break; //analog stream case ARDUINO_SET_ANALOG_STREAM: if (readValuePacketAvmNav()) { streamAnalog = value; writeValuePacketAvmNav(value); for (channel=0;channel<8;channel++) lastAnalog[channel]=-1; } break; case ARDUINO_SET_ANALOG: if (readValuePacketAvmNav()) { if ((channel>=3)&&(channel<=11)) { if (pinModes[channel]!=2) { if (pinModes[channel]==1) servos[channel].detach();
for (channel=0;channel<8;channel++) { if (streamAnalog&(1<<channel)) { value = analogRead(channel); // only send value if it has changed if (value!=lastAnalog[channel]) { command = ARDUINO_ANALOG_STREAM; writeValuePacketAvmNav(value);
lastAnalog[channel]=value; } } }
if (streamDigital) { value=0; for (channel=2;channel<14;channel++) { if (streamDigital&(1<<channel)) { if (pinModes[channel]!=3) { if (pinModes[channel]==1) servos[channel].detach();
Ну наконец то, к обсуждению подключился Steven, теперь, надеюсь, разберёмся совместными усилиями
Steven Gentner писал(а):
bmw318be,
The Arduino code looks fine. I would check that your power requirements are being met. Do you have external power for the Arduino or are you just using USB? Seems that something is wrong with that rather than the code which occasionally works.
The issue of the turret continuing past its extreme points is due to lack of communication with the PC and the Arduino. The Arduino gets the initial messages but looses connection to get the stop signal. Again, most likely a power issue.
If you download the latest Arduino code it has a heartbeat that will stop this runaway code after losing the connection to the PC after 2 seconds. This helps that issue but you still have the concern as to why the connection is bring dropped.
Заголовок сообщения: Re: Трехколесный-бермудский «керогаз» на базе Arduino
Добавлено: 27 фев 2012, 22:29
скрытый хозяин вселенной :)
Зарегистрирован: 18 сен 2006, 12:26 Сообщения: 18018 Откуда: Тверь по прозвищу Дверь
прог. языки: псевдокод =) сила в алгоритме!
ФИО: глубокоуважаемый Фёдор Анатольевич
если бы дело было у нас я подумал на китайский провод до ардуины. но там наверное фирмА и глючные китайские шнурки неизвестны обывателям.
_________________ <telepathmode>На вопросы отвечает Бригадир Телепатов!</telepathmode> Всё уже придумано до нас!
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 8
Вы не можете начинать темы Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете добавлять вложения