roboforum.ru

Технический форум по робототехнике.

Самопальная головка панорамирования (homemade pan tilt)

Раздел создан специально для людей которым интересна робототехника, но в силу разных причин они не знают с чего начать.
Задавайте ваши вопросы, какими бы простыми они не казались, постоянные посетители форума постараются ответить на них по мере своих сил.
Робот своими руками. Самодельный робот.

Re: Самопальная головка панорамирования (homemade pan tilt)

Сообщение dccharacter » 19 янв 2011, 17:37

О, там еще в этом джойстике и force feedback есть. А в оригинальных и датчики силы нажатия кнопок (в моем то ли нет, то ли включить просто не могу). Оригинальные стоят те же 300 руб но уже за пару на ебае. В общем боХатая штуковина, рекомендую.
Мой волшебник это я сам. Всю архитектуру программы придумал лично, а ребята помогли воплотить её. Я бы и сам мог написать, но лень учить язык и его конструкции.
Аватара пользователя
dccharacter
 
Сообщения: 4995
Зарегистрирован: 10 дек 2010, 13:16
Откуда: Красногорск МО
прог. языки: C, Python, wiring/processing
ФИО: Андрей

Re: Самопальная головка панорамирования (homemade pan tilt)

Сообщение M@xSoft » 25 ноя 2011, 22:48

А ссылку на либу и железку можно?
M@xSoft
 
Сообщения: 48
Зарегистрирован: 23 апр 2005, 22:31
Откуда: Украина, г. Донецк
Skype: mcuprick
прог. языки: Basic, PHP, C#
ФИО: Цуприк Максим

Re: Самопальная головка панорамирования (homemade pan tilt)

Сообщение dccharacter » 25 ноя 2011, 23:03

Боюсь наврать за давностию лет. Поищи по PSx. Есть вот такая вещь, но я помню что там библиотек было больше одной:
Код: Выделить всёРазвернуть
/*  Analog PSX Controller Decoder Library (Psx_analog.pde)
   Written by: Kieran Levin Mar 8th, 2009
                  KL: updated July 5 2010
                  updated button defines to fix button mappings
         kieranlevin.com

   Based upon the work by Kevin Ahrendt June 22nd, 2008

   Analog protocal implemented with information from
   http://www.curiousinventor.com/guides/ps2

   Fixed reverse shifting in (MSB->LSB) now reads analog values....
   This also has been tested to work with a generic wireless psx controller

   Controller protocol implemented using Andrew J McCubbin's analysis.
   http://www.gamesx.com/controldata/psxcont/psxcont.htm
   
   Shift command is based on tutorial examples for ShiftIn and ShiftOut
   functions both written by Carlyn Maw and Tom Igoe
   http://www.arduino.cc/en/Tutorial/ShiftIn
   http://www.arduino.cc/en/Tutorial/ShiftOut
   
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------
    Standard Digital Pad

    BYTE    CMND    DATA

     01     0x01    idle
     02     0x42    0x41
     03     idle    0x5A    Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7
     04     idle    data    SLCT           STRT UP   RGHT DOWN LEFT
     05     idle    data    L2   R2    L1  R1   /\   O    X    |_|

    All Buttons active low.

--------------------------------------------------------------------------------
    Analogue Controller in Red Mode

    BYTE    CMND    DATA

     01     0x01    idle
     02     0x42    0x73
     03     idle    0x5A    Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7
     04     idle    data    SLCT JOYR JOYL STRT UP   RGHT DOWN LEFT
     05     idle    data    L2   R2   L1   R1   /\   O    X    |_|
     06     idle    data    Right Joy 0x00 = Left  0xFF = Right
     07     idle    data    Right Joy 0x00 = Up    0xFF = Down
     08     idle    data    Left Joy  0x00 = Left  0xFF = Right
     09     idle    data    Left Joy  0x00 = Up    0xFF = Down
--------------------------------------------------------------------------------
*/

#include "Psx_analog.h"                                          // Includes the Psx Library

#define dataPin 12
#define cmndPin 11
#define attPin 10
#define clockPin 13

//#define motorup  5
//#define motordown 6
//#define motorleft  9
//#define motorright 10

#define center  0x7F
#define LEDPin 3

Psx Psx;                                                  // Initializes the library

void setup()
{
  Psx.setupPins(dataPin, cmndPin, attPin, clockPin);  // Defines what each pin is used
                                                      // (Data Pin #, Cmnd Pin #, Att Pin #, Clk Pin #)
                                                       
  Psx.initcontroller(psxAnalog);   
 
  pinMode(LEDPin, OUTPUT);                                // Establishes LEDPin as an output so the LED can be seen
 
/* //setup motoroutputs
    pinMode(motorup, OUTPUT);                                // Establishes LEDPin as an output so the LED can be seen
    pinMode(motordown, OUTPUT);                                // Establishes LEDPin as an output so the LED can be seen
    pinMode(motorleft, OUTPUT);                                // Establishes LEDPin as an output so the LED can be seen
    pinMode(motorright, OUTPUT);                                // Establishes LEDPin as an output so the LED can be seen
*/
 
  Serial.begin(115200);
  Serial.println("Raw controller values");

 
    // wait for the long string to be sent
  delay(100);
}

void loop()
{
  Psx.poll();                                      // Psx.read() initiates the PSX controller and returns
  Serial.print("\n");                                            // the button data
  Serial.print(Psx.Controller_mode, HEX);     // prints value as string in hexadecimal (base 16)
  Serial.print(Psx.digital_buttons, HEX);     // prints value as string in hexadecimal (base 16) 
  Serial.print(Psx.Right_x, HEX);     // prints value as string in hexadecimal (base 16)   
  Serial.print(Psx.Right_y, HEX);     // prints value as string in hexadecimal (base 16)   
  Serial.print(Psx.Left_x, HEX);     // prints value as string in hexadecimal (base 16)   
  Serial.print(Psx.Left_y, HEX);     // prints value as string in hexadecimal (base 16)     

  if (Psx.digital_buttons & psxR2)                                       // If the data anded with a button's hex value is true,
                                                          // it signifies the button is pressed. Hex values for each
                                                          // button can be found in Psx.h
  {
    analogWrite(LEDPin, HIGH);                           // If button is pressed, turn on the LED
  }
  else
  {
    analogWrite(LEDPin, Psx.Right_x);                            // If the button isn't pressed, turn off the LED
  }
 
    //Psx.Motorsmall = 0xFF;                           // If button is pressed, turn on the LED
    Psx.Motorlarge = Psx.Left_x;

  delay(100);

}
Мой волшебник это я сам. Всю архитектуру программы придумал лично, а ребята помогли воплотить её. Я бы и сам мог написать, но лень учить язык и его конструкции.
Аватара пользователя
dccharacter
 
Сообщения: 4995
Зарегистрирован: 10 дек 2010, 13:16
Откуда: Красногорск МО
прог. языки: C, Python, wiring/processing
ФИО: Андрей

Пред.

Вернуться в Новичкам или основы основ роботостроения.

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 0

cron