Page 4 of 24 FirstFirst 1234567814 ... LastLast
Results 31 to 40 of 236

Thread: PhantomX controlled by a Raspberry Pi

  1. Re: PhantomX controlled by a Raspberry Pi

    Out of curiosity, when you were testing the RPi using the floating point math, were you using a hard float OS? I was thinking about doing the same thing, but I was going to use Raspian, which is a Debian hard float port... maybe this would alleviate some of the performance issues?

  2. #32
    Join Date
    Dec 2012
    Los Angeles, CA
    Rep Power

    Re: PhantomX controlled by a Raspberry Pi

    If you are talking to me. I was using hard float. I'm not sure what you mean by performance issues? The Phoenix software is only a few percent load on the CPU. All the position and speed control is handled by the servos so basically it only has to do six, two joint ik solves, packet transmit and the the xBee serial parsing. It's really not that much when you think about it.

  3. #33
    Join Date
    Dec 2012
    Los Angeles, CA
    Rep Power

    Re: PhantomX controlled by a Raspberry Pi

    Maybe Kurt can comment on his robot. It's using an SSC-32 and the Rpi. I'm curious if it's any more or less load on the CPU. Though I should mention my first go around I had the Rpi doing the interpolation of the steps. I would of course suspect that puts the higher demand on the CPU. In my current config I'm only sending 5 - 7 commands per step with interpolation being handled by the dynamixels.

  4. #34

    Re: PhantomX controlled by a Raspberry Pi

    For me, the two problems were USB throughput, and real math crunching.

    Decompresing and re-compressing a HD JPEG image every frame, and trying to do DSP on it, will quickly eat up your 700 MHz, even with hard float. I imagine just the sheer memory size of those frames is one problem, as the memory subsystem is nowhere near as fast as that of a regular PC.

    Secondly, I had real problems with USB, where it would repeatedly hang, stall out, and even crash the kernel. Lately, the RPi USB support has been improved, but it's still not as good as that on a regular PC. When I'm driving a 14-joint robot at 60 Hz, AND capturing a webcam, AND sending captured video data to a USB WiFi dongle, AND receiving commands from the controlling computer, the USB port wouldn't want to keep up. On a PC with three USB 2.0 busses and two USB 3.0 busses, and much more thoroughly designed and debugged USB controllers and drivers, those problems go away.

  5. #35

    Re: PhantomX controlled by a Raspberry Pi

    Yep, probably can not expect a full pc with USB 3 functionality for about $40.

    I wonder has anyone tried using a wifi connected through the Lan connection instead of USB (do they still make them).
    Edit: Yep still do:

    Would that help with it? Also will be interesting to see how their camera hooks up and well it does.

    For me, just having fun!

    Last edited by KurtEck; 03-23-2013 at 11:31 AM.

  6. #36

    Re: PhantomX controlled by a Raspberry Pi

    The LAN connector sits on the same USB bus as the external USB ports. Using a WiFi-LAN bridge would perhaps solve the problem of "some linux WiFi drivers are pretty poor" but would not solve the "RPi USB isn't super great" problem. That being said, the RPi is still a great value for the money, and the USB support HAS improved this year, so it's not a non-starter by any means. Just make sure you apply it to the right kind of problem :-)

  7. #37
    Join Date
    Dec 2012
    Los Angeles, CA
    Rep Power

    Re: PhantomX controlled by a Raspberry Pi

    Xevel sent me the patched dxl_hal so I can switch over to the usb2ax. Which is great since the usb2dynamixel is so big it was sitting on top of the PhantomX. This will really clean up the look of the hex.

  8. #38

    Re: PhantomX controlled by a Raspberry Pi

    I have been playing around trying to figure out ways to compile and link with system libraries... In particular to be able to Speak...

    So I used apt-cache search libespeak*
    To find the appropriate things (I think). Did this on several other different searches as well. I think I also installed something like espeak-dev ...

    I also did a search on the net for using espeak in a program and found a simple program...

       TITLE: Simple C/C++ Program showing use of speak_lib.h 
       AUTHOR:Dhananjay Singh
       LICENSE: GPLv2
    #include <string.h>
    #include <malloc.h>
    #include <speak_lib.h>
    espeak_POSITION_TYPE position_type;
    espeak_AUDIO_OUTPUT output;
    char *path=NULL;
    int Buflength = 500, Options=0;
    void* user_data;
    t_espeak_callback *SynthCallback;
    espeak_PARAMETER Parm;
       FROM speak_lib.h :
       output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
       Buflength:  The length in mS of sound buffers passed to the SynthCallback function.
       options: bit 0: 1=allow espeakEVENT_PHONEME events.
       path: The directory which contains the espeak-data directory, or NULL for the default location.
       espeak_Initialize() Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR).
    char Voice[] = {"default"};
        Voice: Refer to speak_lib.h 
    char text[20] = {"Hello World!"};
    unsigned int Size,position=0, end_position=0, flags=espeakCHARS_AUTO, *unique_identifier;
       text: The text to be spoken, terminated by a zero character. It may be either 8-bit characters,
          wide characters (wchar_t), or UTF8 encoding.  Which of these is determined by the "flags"
       Size: Equal to (or greatrer than) the size of the text data, in bytes.  This is used in order
          to allocate internal storage space for the text.  This value is not used for
       position:  The position in the text where speaking starts. Zero indicates speak from the
          start of the text.
       position_type:  Determines whether "position" is a number of characters, words, or sentences.
       end_position:  If set, this gives a character position at which speaking will stop.  A value
          of zero indicates no end position.
       flags:  These may be OR'd together:
          Type of character codes, one of:
             espeakCHARS_UTF8     UTF8 encoding
             espeakCHARS_8BIT     The 8 bit ISO-8859 character set for the particular language.
             espeakCHARS_AUTO     8 bit or UTF8  (this is the default)
             espeakCHARS_WCHAR    Wide characters (wchar_t)
          espeakSSML   Elements within < > are treated as SSML elements, or if not recognised are ignored.
          espeakPHONEMES  Text within [[ ]] is treated as phonemes codes (in espeak's Hirshenbaum encoding).
          espeakENDPAUSE  If set then a sentence pause is added at the end of the text.  If not set then
             this pause is suppressed.
       unique_identifier: message identifier; helpful for identifying later 
         data supplied to the callback.
       user_data: pointer which will be passed to the callback function.
       espeak_Synth() Returns: EE_OK: operation achieved 
                               EE_BUFFER_FULL: the command can not be buffered; 
                               you may try after a while to call the function again.
    int main(int argc, char* argv[] ) 
        output = AUDIO_OUTPUT_PLAYBACK;
        int I, Run = 1, L;    
        espeak_Initialize(output, Buflength, path, Options ); 
        Size = strlen(text)+1;    
        printf("Saying  '%s'",text);
        espeak_Synth( text, Size, position, position_type, end_position, flags,
        unique_identifier, user_data );
        espeak_Synchronize( );
        return 0;
    I then tried to compile this and found I needed to add -I/usr/include/espeak
    to compile the main program. But then needed lib to link to. So I did a search
    find \dev\lib -name libespeak*
    And found stuff in /usr/lib/arm-linux-gnueabihf

    Not sure what the best way to include this in the compile, but I added /usr/lib/arm-linux-gnueabihf/
    Into my link phase...
    Make file now looks like:
    SHELL := /bin/sh
    .SUFFIXES: .c .o .cpp
    DESTDIR = 
    prefix = /usr/local
    bindir = $(prefix)/bin
    srcdir = .
    INSTALL = install
    PROGRAM := Speak
    OBJFILES := Speak.o
    Speak: $(OBJFILES) 
    speak.o: speak.cpp
    CFLAGS = -Wall -O2
    XCPLAY_CFLAGS := -pthread -fno-rtti -g -I/usr/include/espeak
    #XCPLAY_LDFLAGS := -pthread -fno-rtti -g -L/usr/lib/arm-linux-gnueabihf -libespeak.a
    XCPLAY_LDFLAGS := -pthread -fno-rtti  /usr/lib/arm-linux-gnueabihf/ -g
    all: $(PROGRAM)
    %.o: %.c
        $(CC) -o $@ -c $< $(CFLAGS) $(XCPLAY_CFLAGS)
    %.o: %.cpp
        g++ -o $@ -c $< $(CFLAGS) $(XCPLAY_CFLAGS)
        $(CC) -o $@ $(LDFLAGS) $(XCPLAY_LDFLAGS) $(OBJFILES)
        rm -rf $(PROGRAM) dist *.o *.tar.gz
    Not sure if this is the best or suggested way to linK????? But it does compile and link now and when I run it
    "Hello World" Comes out of the speakers...

    Again suggestions on how one should include include files and libraries would be highly appreciated.


    Edit: Next up is to add function to my RPI Phoenix code to have it say stuff...

  9. #39
    Join Date
    Dec 2012
    Los Angeles, CA
    Rep Power

    Re: PhantomX controlled by a Raspberry Pi

    This is great! I'll take a stab at it in the next couple of days as well. Nice work. That's a lot better than a system ("espeak") call. :P

  10. #40
    Join Date
    Sep 2010
    Rep Power

    Re: PhantomX controlled by a Raspberry Pi

    It's a cut down version of the makefile I use with CM-510/530/700 embedded-c stuff. Splitting everything up into separate areas makes it a bit easier to understand and modify for later. Compiles and runs the example code you posted well enough on 12.04 64-bit, and will hopefully work on an rpi. There are a few variables that will probably need changing for the rpi. Be warned: the forum code tags transform all tabs to spaces, so you will have to replace all the indentations with tabs for make to work (get really uninformative error messages if not tabs).

    #~~~~~~~~~~~~~~~~~~~~ Output File Name ~~~~~~~~~~~~~~~~~~~~
    MAIN_OUT = Speakeasy
    #~~~~~~~~~~~~~~~~~~~~ Source Files ~~~~~~~~~~~~~~~~~~~~
    MAIN_OBJS = \
    #~~~~~~~~~~~~~~~~~~~~ Include Directories ~~~~~~~~~~~~~~~~~~~~
    INCLUDE_DIRS = -I. -I/usr/include/espeak
    #~~~~~~~~~~~~~~~~~~~~ Library Directories ~~~~~~~~~~~~~~~~~~~~
    #LIBRARY_DIRS = -L/usr/lib/arm-linux-gnueabihf
    #~~~~~~~~~~~~~~~~~~~~ Compiler Options ~~~~~~~~~~~~~~~~~~~~
    #COMPILE_OPTS = -Wall -pedantic -g -O2 -fno-rtti
    COMPILE_OPTS = -Wall -pedantic -g -O2
    #~~~~~~~~~~~~~~~~~~~~ Linker Options ~~~~~~~~~~~~~~~~~~~~
    LDFLAGS = $(LIBRARY_DIRS) -lpthread -lespeak
    #~~~~~~~~~~~~~~~~~~~~ Toolchain Prefix ~~~~~~~~~~~~~~~~~~~~
    #~~~~~~~~~~~~~~~~~~~~ all ~~~~~~~~~~~~~~~~~~~~
    all: begin gccversion build end
    #~~~~~~~~~~~~~~~~~~~~ build ~~~~~~~~~~~~~~~~~~~~
    build: $(MAIN_OUT)
    MSG_BEGIN = -------- begin --------
    MSG_END = --------  end  --------
    #~~~~~~~~~~~~~~~~~~~~ Eye candy ~~~~~~~~~~~~~~~~~~~~
        @echo $(MSG_BEGIN)
        @echo $(MSG_END)
        @$(CC) --version
    #~~~~~~~~~~~~~~~~~~~~ clean ~~~~~~~~~~~~~~~~~~~~
    clean: begin clean_list end
        -rm $(MAIN_OBJS)
        -rm $(MAIN_OUT)
    #~~~~~~~~~~~~~~~~~~~~ backup ~~~~~~~~~~~~~~~~~~~~
    backup: clean
        tar cJvf ../$(MAIN_OUT)_`date +"%Y-%m-%d_%H%M"`.tar.xz *
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question(s) Raspberry Pi
    By Robonaut in forum Robot Computers
    Replies: 20
    Last Post: 07-07-2013, 11:46 AM
  2. Raspberry Pi Camera coming soon
    By sarendt in forum Robotics General Discussion
    Replies: 1
    Last Post: 03-16-2013, 11:15 PM
  3. About to give up on the Raspberry Pi
    By jwatte in forum Software and Programming
    Replies: 5
    Last Post: 01-14-2013, 11:57 AM
  4. Just For Fun My Raspberry PI
    By rebel in forum Arbotix, Microcontrollers, Arduino
    Replies: 0
    Last Post: 12-31-2012, 06:57 PM
  5. For learning: PhantomX Hexapod vs PhantomX Quadruped
    By Leugim in forum Humanoids, Walkers & Crawlers
    Replies: 4
    Last Post: 10-26-2012, 09:50 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts