Page 4 of 4 FirstFirst 1234
Results 31 to 40 of 40

Thread: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

  1. #31
    Join Date
    Jan 2008
    Location
    Norway, Stavanger
    Posts
    790
    Images
    276
    Rep Power
    78

    Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Yes. 1500 is a width of 1500 microseconds.
    Kåre Halvorsen aka Zenta
    ---------------------------------
    Zenta's YouTube channel
    Zenta's Blog
    Zenta's Instagram

  2. Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Update:

    Had a small patch of time last night so I went through the servo calibration spread sheet and calculated the new cPwmDiv and cPFConst.

    After that I physically offset the femur and tarsus by 1 click, just like the 4dof T-Hex tutorial on Lynxmotion.

    The "Joint offsets" in the code I set to 150 for Femur (mistake here, should be -150 for femur) and -150 for tarsus. Everything seem to work OK----Big thanks again to KurtEck and Zenta

    I also tried updating the ps2 control code like punyviking suggested, but it didn't work: Pressing L1 seem to make the robot permanently stuck in shift mode with no way of getting out

    I also would like to know a bit more about this part of the code:
    //[START POSITIONS FEET]
    #define cHexInitXZ 105
    #define CHexInitXZCos45 74 // COS(45) = .7071
    #define CHexInitXZSin45 74 // sin(45) = .7071
    #define CHexInitY 26

    As far as I can tell this part of the code determines the robot's "stance" when starting up: how wide to spread the legs and how high to stand----am I correct?

    It seems straight forward. But what I want to know is: do you set these values to whatever you like? Or is there a set of rules? Currently I have my own set of values that I got from trial and error, and it is less than great----surely there is a "optimal" stance? Like setting it so that the tarsus is perfectly vertical to the ground, when starting up, etc??

    If there are such thing as a "optimal stance", how do I find it?

    Thanks for the help in advance.

    Kind regards,


    powerover

  3. #33
    Join Date
    Jan 2008
    Location
    Norway, Stavanger
    Posts
    790
    Images
    276
    Rep Power
    78

    Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Good to hear you got it working.

    Quote Originally Posted by powerover View Post
    As far as I can tell this part of the code determines the robot's "stance" when starting up: how wide to spread the legs and how high to stand----am I correct?
    Yes, that's correct. The cHexInitXZ determine the horizontal distance between the center of coxa and the center of the foot (for the middle legs). Normally you want this distance to be the same for all legs, therefore the CHexInitXZCosXX and CHexInitXZSinXX is manually set to get the correct X and Z init position for the front and rear legs. Where XX is the coxa offset/angle value for the current robot. But you are free to set these values to whatever you feel like is the best for your robot. Also consider the total weight of the robot vs. servo strength.

    Ideally the init position should be the position that gives all legs as much free movement as possible equally in all direction. So it's a "center" position, simply said.

    One simple rule is to set the
    cHexInitXZ = femurlength + coxalength. That gives you a strong configuration but I often find it a bit to short. Several years ago I used an Excel sheet called PEP as a tool to determine the init position.


    Trial and error works too, just be careful not overloading the servos. Do some torque math first and go for the initpositions that looks good. Place the hex on the floor and do some manual measurements is a good method too.
    Kåre Halvorsen aka Zenta
    ---------------------------------
    Zenta's YouTube channel
    Zenta's Blog
    Zenta's Instagram

  4. Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Hi Zenta,

    Thanks for your replay and you info, really helpful for us newbies here, greatly appreciated,

    However the robot is not completely working just yet, the inability to get out of shift mode once "L1" is pressed is still a major problem here, I will have to do more trouble shooting and code reading when I have time.

    Looking forward to tidying up the cabling and uploading photos.

    Kind regards,

    powerover

  5. #35
    Join Date
    Jan 2008
    Location
    Norway, Stavanger
    Posts
    790
    Images
    276
    Rep Power
    78

    Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    No problem. Not sure about the L1, its been a while since I used the PS2 as remote. It should be an easy fix though.
    Kåre Halvorsen aka Zenta
    ---------------------------------
    Zenta's YouTube channel
    Zenta's Blog
    Zenta's Instagram

  6. Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Hi all,

    Update:

    I asked my friend with a software engineering background to look a the ps2 control library code with me and we figured out why it was getting stuck in L1:

    The part of code that gets the robot out of L1 is only compiled IF "#define OPT_SINGLELEG" is enabled....I enabled that code and all works well.

    Robot is walking reasonably well and cables are all as tidy as I can get them at the moment, I would say stage 1 is complete:

    Stage 1: get the robot walking platform working at the satisfactory level....done
    Stage 2: feet sensor, this will eliminate the constant need to recalibrate the servos.
    Stage 3: add FPV
    Stage 4: add pixycam robot vision
    Stage 5: swap PS2 controller for futaba radio
    Stage 6: swap arduino mega with teensy 3.2
    Stage 7: swap 3D printed body parts with folded sheetmetal parts

    Big write up coming up, summing up my experience of getting stage 1 complete, hopefully it can help others in some way.

    Photos will be up soon-ish.

    Once again big thank you to KurtEck and Zenta

    Have a Merry Christmas everyone, watch this space...


    Kind regards,

    powerover
    Last edited by powerover; 12-24-2016 at 02:59 AM.

  7. #37
    Join Date
    Jan 2008
    Location
    Norway, Stavanger
    Posts
    790
    Images
    276
    Rep Power
    78

    Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Good to hear you got it working!
    Merry Christmas!
    Kåre Halvorsen aka Zenta
    ---------------------------------
    Zenta's YouTube channel
    Zenta's Blog
    Zenta's Instagram

  8. Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Click image for larger version. 

Name:	IMG_20161225_065153.jpg 
Views:	112 
Size:	85.6 KB 
ID:	6806

    Currently Looking at the Main Phoenix code for possible points of inserting feet sensor code, I think I can see a few potential places where I can just implement a simple on/off switch trial to start with:

    Mini goal 1:
    Keep lowering the leg in the Z direction until the contact switch is triggered.


    When the user stop the robot from walking forward, the robot "taps" each leg, I assume to make sure each leg is in its natural / initial position? But I can't find the part of code that implement this "taping motion", can someone point me toward this section of the code?

    Many thanks in advance.

    Merry xmas, and eat until you drop


    Kind regards,

    powerover

  9. #39
    Join Date
    Jan 2008
    Location
    Norway, Stavanger
    Posts
    790
    Images
    276
    Rep Power
    78

    Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Hi,

    The gait algorithm in the Phoenix code is static and adding terrain adaptation is a real challenge..

    The "tapping part" is just to make sure all legs are placed back to the init positions, this is also necessary if you change gait method. This is actually one of the Achilles heal to this gait algorithm, for example you can't change the gait method while walking. One of the reasons is that one gait cycle only consists of relative few steps.

    The tapping motion is simply one extra gait cycle. Study the gait functions. Also Xanore (Jeoren Janssen) made a short write-up about how his gait algorithm worked.

    In the main loop you'll see this part:
    Code:
    if (bExtraCycle>0){       bExtraCycle--;
          fWalking = !(bExtraCycle==0);
    ...
    Have to go. More eating..
    Kåre Halvorsen aka Zenta
    ---------------------------------
    Zenta's YouTube channel
    Zenta's Blog
    Zenta's Instagram

  10. Re: Setting up Arduino Mega 2560 with RC input control with modified Phantom X

    Hi Zenta,

    Thanks for your reply. After spending some serious effort reading the code, I came to the same conclusion as you----it is a real challenge to add terrain adaptation.

    I have decided to have a crack at writing my own code from scratch, just so I have more control / understanding of how the whole thing works. Right now I only have a vague understanding, feel like taking the easy way out / cheating by using other people's hard work.

    So far I think I have a good understanding of how the leg IK works, and how to figure out angles for each segment of the leg given a end position----but I am having trouble wrapping my head around the body FK.

    I will be starting a new thread soon for this topic, and I look forward to your guidance for the long journey ahead.


    Kind regards,

    powerover

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dynamixel Servo Control Issues (MX-28 and Arduino Mega)
    By JasonT in forum DYNAMIXEL & Robot Actuators
    Replies: 1
    Last Post: 08-12-2014, 07:12 PM
  2. Arduino Mega 2560 and Serial Comunication issues
    By DVS in forum Arbotix, Microcontrollers, Arduino
    Replies: 3
    Last Post: 07-10-2013, 02:31 PM
  3. Arduino Mega 2560 and AX12A servos
    By DVS in forum DYNAMIXEL & Robot Actuators
    Replies: 3
    Last Post: 07-08-2013, 04:26 PM
  4. Arduino Mega 2560 and AX12A servos
    By DVS in forum Sensors
    Replies: 1
    Last Post: 07-08-2013, 04:09 PM
  5. Question(s) I'm having trouble getting an arduino analog input to work
    By Whiterabbit in forum Arbotix, Microcontrollers, Arduino
    Replies: 4
    Last Post: 09-01-2009, 01:41 AM

Posting Permissions

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