Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Taking a journey with python3

  1. #21

    Re: Taking a journey with python3

    Quote Originally Posted by robotsurgery View Post
    I am back. I have tried what you suggested to no avail. ...
    Quote Originally Posted by robotsurgery View Post
    Should a logic analyzer be the way to go? Or could I get another pass-through device like the USB2AX? The code im trying to use is my own from scratch it has been posted earlier in the thread, python 3 as the title says, Raspberry Pi 3 model B, Rasbian.
    I usually have a logic analyzer out and use it any time I have issues about what is actually being output (or input)....

    I mentioned posting the sources in #19 as in #18 you mentioned, I have tried what you suggested, which implied the sources have changed.

    As for USB2AX - I like them for simple stuff where you simply wish to control a set of servos, without having to worry about what is running on the device. But it will only work if you give it valid packets as well.

    Edit: Also meant to ask, if you tried this on windows again what version of Python 3, pyserial... would I need? Most likely though would just use the RPI3 I have sitting around
    Last edited by KurtEck; 02-07-2018 at 08:47 AM.

  2. #22

    Re: Taking a journey with python3

    Code:
    port = '/dev/ttyUSB0'
    baud = 38400
    
    
    ser = serial.Serial(port, baud)
    ser.flushInput()
    
    ser.close()
    I am not sure if I asked before... Does your code look something like the above?
    I believe from your first posting that you are trying to talk to AX-12 servos?
    Did you update these servos? That is they default to baud = 1000000 not 38400

  3. Re: Taking a journey with python3

    Quote Originally Posted by KurtEck View Post
    I usually have a logic analyzer out and use it any time I have issues about what is actually being output (or input)....

    I mentioned posting the sources in #19 as in #18 you mentioned, I have tried what you suggested, which implied the sources have changed.

    As for USB2AX - I like them for simple stuff where you simply wish to control a set of servos, without having to worry about what is running on the device. But it will only work if you give it valid packets as well.

    Edit: Also meant to ask, if you tried this on windows again what version of Python 3, pyserial... would I need? Most likely though would just use the RPI3 I have sitting around
    Well my problem is I don't have a logic analyzer. Im using Py3.6 and pyserial 3.4.

  4. Re: Taking a journey with python3

    Quote Originally Posted by KurtEck View Post
    Code:
    port = '/dev/ttyUSB0'
    baud = 38400
    
    
    ser = serial.Serial(port, baud)
    ser.flushInput()
    
    ser.close()
    I am not sure if I asked before... Does your code look something like the above?
    I believe from your first posting that you are trying to talk to AX-12 servos?
    Did you update these servos? That is they default to baud = 1000000 not 38400
    Well after I read this I tried that baud and I still nothing.

  5. #25

    Re: Taking a journey with python3

    Yes understand you don't have Logic Analyzer... Just mentioned it as that is what I would use...

    And in problems like this, I also try to break down the problem, to hopefully to make sure I am trying to solve the wrong problem.

    So I believe you have the Servos hooked up to an Arbotix-m? What sketch are you running on the arbotix? Built with which version of Arduino IDE?

    How many servos are connected? If multiple ones, suggest only one. As by default all ship with ID #1 and if multiple ones are on the buss, maybe packet missed.

    How is the Arbotix-m board powered? 12v wall wart? Battery? i.e. - maybe the data is being properly sent but not received...

    As for Baud rate for the Python, again this will depend on what program is running on the Arbotix-m... What baud rate did it open the Serial port at?

    I am assuming you are using an FTDI cable to connect the RPI to the Arbotix? Also I am assuming you don't have an XBee plugged into the Arbotix, as both the FTDI and XBee share the same Serial port on the Arbotix.

    Again I am assuming that your FTDI cable is showing up on your RPI as /dev/ttyUSB0... If there are other FTDI like devices, your connection could be /dev/ttyUSB1 or USB2 ... Also I am assuming you have access permission to use the /dev/ttyUSB0 object on the RPI or I would guess that Python would complain if the port failed to open?

    On Windows, I assume you changed this string to something more appropriate like: COM5
    Note: not sure exact strings that pyserial requires...

    Again hard to know where to debug first... Again one of my first steps would be to have a simple program on Arbotix that when it receives input maybe it blinks its own LED for each character received and maybe echo it back...

    Again sorry I can not give you any better answers.

  6. #26

    Re: Taking a journey with python3

    The reason why I mentioned all of the above, is I hooked up an USB2AX to my RPI3, I have one servo on it.
    To be complete, I have the USB2AX connected to one of the Trossen powered Ax/MX hubs. I then have the servo connected to it, and I have a 12v 5Amp wall wart powering the hub...

    I now have two python scripts:
    Code:
    pi@raspberrypi:~ $ cat led_on.py
    #!/usr/bin/env python
    
    import serial
    port = '/dev/ttyACM0'
    baud = 1000000
    
    
    ser = serial.Serial(port, baud)
    ser.flushInput()
    ser.flushOutput()
    ser.write(b'\xff\xff\xfe\x04\x03\x19\x01\xe0')
    ser.flush()
    ser.close()
    pi@raspberrypi:~ $ cat led_off.py
    #!/usr/bin/env python
    
    import serial
    port = '/dev/ttyACM0'
    baud = 1000000
    
    
    ser = serial.Serial(port, baud)
    ser.flushInput()
    ser.flushOutput()
    ser.write(b'\xff\xff\xfe\x04\x03\x19\x00\xe1')
    ser.flush()
    ser.close()
    pi@raspberrypi:~ $
    Note: I edited the scripts as USB2AX is not an FTDI device so it creates the device /dev/ttyACM0 and it defaults to 1000000 baud rate.

    So when I type: python3 ./led_on.py
    The led on my Servo turns on.. and likewise when I type: python3 ./led_off.py
    The led turns off...

  7. Re: Taking a journey with python3

    Quote Originally Posted by KurtEck View Post
    The reason why I mentioned all of the above, is I hooked up an USB2AX to my RPI3, I have one servo on it.
    To be complete, I have the USB2AX connected to one of the Trossen powered Ax/MX hubs. I then have the servo connected to it, and I have a 12v 5Amp wall wart powering the hub...

    I now have two python scripts:
    Code:
    pi@raspberrypi:~ $ cat led_on.py
    #!/usr/bin/env python
    
    import serial
    port = '/dev/ttyACM0'
    baud = 1000000
    
    
    ser = serial.Serial(port, baud)
    ser.flushInput()
    ser.flushOutput()
    ser.write(b'\xff\xff\xfe\x04\x03\x19\x01\xe0')
    ser.flush()
    ser.close()
    pi@raspberrypi:~ $ cat led_off.py
    #!/usr/bin/env python
    
    import serial
    port = '/dev/ttyACM0'
    baud = 1000000
    
    
    ser = serial.Serial(port, baud)
    ser.flushInput()
    ser.flushOutput()
    ser.write(b'\xff\xff\xfe\x04\x03\x19\x00\xe1')
    ser.flush()
    ser.close()
    pi@raspberrypi:~ $
    Note: I edited the scripts as USB2AX is not an FTDI device so it creates the device /dev/ttyACM0 and it defaults to 1000000 baud rate.

    So when I type: python3 ./led_on.py
    The led on my Servo turns on.. and likewise when I type: python3 ./led_off.py
    The led turns off...
    Click image for larger version. 

Name:	20180205_131515.jpg 
Views:	14 
Size:	90.3 KB 
ID:	7163

    I have one AX-12 connected to the Arbotix-m. The Arbotix is running the pypose.ino sketch that translates the serial signal received into AX-12 "language". I have the Arbotix connected to 12v via wall wart (12v .5A).

    My Arduino is v1.0.6. as per the Trossen instructions. Ive tried sending the signal with ID of 0x00, 0x01, 0xfe. For the baud rate ive tried 9600, 34800, and 1000000.

    I am assuming you are using an FTDI cable to connect the RPI to the Arbotix? Also I am assuming you don't have an XBee plugged into the Arbotix, as both the FTDI and XBee share the same Serial port on the Arbotix.
    Correct.

    Again I am assuming that your FTDI cable is showing up on your RPI as /dev/ttyUSB0... If there are other FTDI like devices, your connection could be /dev/ttyUSB1 or USB2 ... Also I am assuming you have access permission to use the /dev/ttyUSB0 object on the RPI or I would guess that Python would complain if the port failed to open?
    I may have to double check if it was the right port, which is why im testing on windows.

    On Windows, I assume you changed this string to something more appropriate like: COM5
    Yes.

    Again hard to know where to debug first... Again one of my first steps would be to have a simple program on Arbotix that when it receives input maybe it blinks its own LED for each character received and maybe echo it back...
    the AXSimpleTest.ino sketch works fine. Arbotix to motor seems to not be the problem.'

    Theoretically the script you posted should work for me yes? Im assuming it worked for you?

  8. #28

    Re: Taking a journey with python3

    Again it would be good if you posted your actual current scripts and Arbotix program you are running.

    You mentioned pypose. Is it this one? https://github.com/Interbotix/arboti...ose/pypose.ino

    If so I am not sure it will blindly send data to a specific servo... I did not look too carefully at it, but did not see anywhere where it was echoing the stuff coming in from Serial to the AX Buss. What I did see was it setup Poses and then allowed you to send commands to do stuff with poses.

    There are other drivers around that can do it. I think their ROS driver one https://github.com/Interbotix/arboti...es/ros/ros.ino

    Has the Pass through stuff. I have some of my own, although mostly I use Teensy 3.x boards for these...

    As for will my python scripts work for you... Again need to edit it back to /dev/ttyUSB0 instead of /dev/ttyACM0

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dan's ROS Journey
    By TXBDan in forum ROS - Robot Operating System
    Replies: 10
    Last Post: 08-26-2016, 11:52 AM
  2. Question(s) designing board - taking 3.3V from the OPEN CM9?
    By fabrice in forum Arbotix, Microcontrollers, Arduino
    Replies: 1
    Last Post: 04-28-2016, 12:24 PM
  3. Project Project BETH aka Dan's journey into a lot of things.
    By TXBDan in forum Humanoids, Walkers & Crawlers
    Replies: 32
    Last Post: 02-14-2014, 09:15 AM
  4. Big Congrats to lnxfergy for taking Gold on Mech Warfare!
    By DresnerRobotics in forum Mech Warfare
    Replies: 6
    Last Post: 06-16-2009, 10:07 PM
  5. News/Announcement Now taking Pre-Orders on the Bioloid Boomerang Zigbee Controller!
    By DresnerRobotics in forum Humanoids, Walkers & Crawlers
    Replies: 6
    Last Post: 10-25-2008, 09:51 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
  •