PBP projects for R/C models


Closed Thread
Results 1 to 40 of 772

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Red face A youtube video. Not very enlightening...

    I made this video of my car on my "race track"

    As I speed up the car the behavior becomes less consistent.

    Take a look see if you like. It's only a couple minutes long and the car does work correctly sometimes.



    Ken

  2. #2
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Question I need some help

    I want to use the interrupt system to make my Pulse Width Modulated pulses output at 50hz. I am hoping that will give me finer control of the wheel speed and maybe a quicker steering response.

    I understand that I need to preset TMR1 with a number so that it rolls over every 20 ms. thereby triggering the interrupt. How do I figure out what that preset number should be and how do I set it using PBP?

    Ken

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Looking at the datasheet:
    6.7 Timer1 Interrupt

    The Timer1 register pair (TMR1H:TMR1L) increments
    to FFFFh and rolls over to 0000h. When Timer1 rolls
    over, the Timer1 interrupt flag bit of the PIR1 register is
    set. To enable the interrupt on rollover, you must set
    these bits:
    • TMR1ON bit of the T1CON register
    • TMR1IE bit of the PIE1 register
    • PEIE bit of the INTCON register
    • GIE bit of the INTCON register
    The interrupt is cleared by clearing the TMR1IF bit in
    the Interrupt Service Routine.
    With a 4MHz clock, (TMR1H:TMR1L) increments every 1uS. To generate an interrupt every 20mS, you want it to count 20,000 - so preload (TMR1H:TMR1L) with 65535-20000 = 45535 or FFFFh-4E20h=B1DFh.

  4. #4
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I may have to add another SRF05

    I think a big part of my problem is peripheral vision (hearing) of the front
    sensors. As the car sped up I had to increase the frontdanger threshold. Now if the car gets turned a little to the left while running down the straight
    it 'sees' the cardboard and turns left thinking that it is coming to the
    corner. Solutions?

    The simple one is to place the cardboard further away from the side wall.

    I could rewrite the code so that hard turning left only is allowed when close to the side wall. Trouble with that is if the car ever got free in a room it would crash straight into walls.

    I could add left side SRF05's. That would make staying in the middle of the lane easier and minimize the effect of peripheral hearing.

    What do you all think?

    Ken

  5. #5
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default I added a port side sonar

    I have added a left looking SRF05. This gives the car great new autonomous potential. I shall stick to the first problem first. Disappear behind a card board wall and come out the other end at speed.

    My first thought is to stick to the path half way between the solid wall and the card board wall using the right and left sensors for guidance. If I can keep the car pretty much following that line without oscillating then once the front echo says, "DANGER", the car will know that it must be approaching a corner.

    Algorithm suggestions are welcome.
    Ken

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    You do have oscillations don't you?

    Well, the best way to avoid them is the PID suggested again earlier.

    Give it a try and see the beauty of automatic control. You cannot do it other way.

    Ioannis

  7. #7
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Smile I added a left hand side sonar sensor

    I think this video does a pretty good job of showing the potential of this PIC controlled car.

    )

    With the three sensors this car might be able to negotiate a true maze.

    What do you think?

    Ken

  8. #8
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    You do have oscillations don't you?

    Well, the best way to avoid them is the PID suggested again earlier.

    Give it a try and see the beauty of automatic control. You cannot do it other way.

    Ioannis
    Good advice here.

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    I want to use the interrupt system to make my Pulse Width Modulated pulses output at 50hz. I am hoping that will give me finer control of the wheel speed and maybe a quicker steering response.

    I understand that I need to preset TMR1 with a number so that it rolls over every 20 ms. thereby triggering the interrupt. How do I figure out what that preset number should be and how do I set it using PBP?

    Ken
    I wonder if something like this could be made to work for you?
    http://www.picbasic.co.uk/forum/showthread.php?t=7393
    or
    http://www.picbasic.co.uk/forum/cont...gle-Modulation)
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 11:26
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30
  5. Making PBP code more modular
    By forgie in forum General
    Replies: 30
    Last Post: - 25th October 2005, 16:24

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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