How to Train Your Robot

Excerpt

HTTYR home


How to Train Your Robot is a long term side project. I’ve been working on it in some form for 20 years. My lifetime goal is to make a robot as smart as my pup. It’s a long road, but it has a lot of fascinating stops like machine learning, Python development, software engineering, and robotics. Come join me.

[

Chapter 1: Can’t AI Already Do That?

](https://tyr.fyi/1)[

Chapter 2: Keeping Time with Python

](https://tyr.fyi/2)[

Chapter 3: Getting Processes to Talk to Each Other

](https://tyr.fyi/3)[

Chapter 4: Making Animations with Matplotlib

](https://tyr.fyi/4)[

Chapter 5: Simulating the Physical World

](https://tyr.fyi/5)[

Chapter 6: Making Your Python Code Run Faster

](https://tyr.fyi/6)[

[In progress] Chapter 7: Would You Like to Play a Game?

](https://tyr.fyi/7)[

[In progress] Chapter 8: Deconstructing Sound

](https://tyr.fyi/8)[

Chapter 9: Ziptie: Learning Useful Features

](https://brandonrohrer.com/ziptie)[

[In progress] Chapter 10: Reconstructing Sound

](https://tyr.fyi/10)[

Chapter 11: Naive Cartographer: A Markov Decision Process Learner

](https://brandonrohrer.com/cartographer)[

[In progress] Chapter 12: Myrtle: A Benchmarking Framework for Reinforcement Learning

](https://codeberg.org/brohrer/myrtle/projects)[

[In progress] Chapter 13: A Dead Simple Message Queue

](https://tyr.fyi/13)



[

Chapter 1: Can’t AI Already Do That?

](https://tyr.fyi/1)

  • 5. AI is still not as smart as my Shih Tzu.
  • 8. Unsupervised learning
  • 13. Supervised learning
  • 18. Reinforcement learning
  • 19. Rewards
  • 20. Labels
  • 24. Reward engineering
  • 28. Human-Directed Reinforcement Learning (HDRL)
  • 31. Sample efficiency

[

Chapter 2: Keeping Time with Python

](https://tyr.fyi/2)

  • 5. The wall clock
  • 8. Measuring time
  • 17. Python
  • 19. Platform (in)dependence
  • 21. time.time()
  • 25. Timing code
  • 35. time.sleep()
  • 42. Pacing code
  • 48. The Pacemaker class

[

Chapter 3: Getting Processes to Talk to Each Other

](https://tyr.fyi/3)

  • 6. Why muliple processes?
  • 8. Why not threads?
  • 10. Case study: Counting people
  • 11.The getkey package
  • 14. Python environment management
  • 16. Getting keypresses
  • 21. multiprocessing.Queue
  • 27. Connecting processes with a Queue
  • 33. Logging
  • 34. Over-engineering vs under-engineering
  • 42. Logging with JSON
  • 53. Linting with flake8 and autoformatting with black
  • 60. Reporting
  • 69. Shell scripting

[

Chapter 4: Making Animations with Matplotlib

](https://tyr.fyi/4)

  • 5. Case Study: Lissajous oscillations
  • 8. Animation and robotics
  • 9. Frame rate
  • 12. Matplotlib
  • 13. Object-Oriented Programming
  • 20. Drawing with Matplotlib
  • 22. Animation with Matplotlib
  • 26. Colors
  • 29. Order and depth
  • 36. Patches
  • 41. Translation
  • 44. Scaling
  • 45. Anchors
  • 51. Rotation
  • 61. Point to point movement
  • 69. Minimum-jerk speed profiles
  • 74. Logit-normal speed profiles

[

Chapter 5: Simulating the Physical World

](https://tyr.fyi/5)

  • 6. Case study: Tetris shapes
  • 7. Force = mass x acceleration
  • 10. Numerical differentiation
  • 14. Numerical integration
  • 21. Separate processes for simulation and animation
  • 26. Platform (in)dependence
  • 32. Modeling atom-to-atom contact
  • 39. Modeling atom-to-wall contact
  • 45. Pitfalls of time discretization
  • 48. Correcting for time discretization
  • 53. Friction and inelasticity
  • 60. Objects that are not circles
  • 70. Stationary features
  • 72. Initializating objects

[

Chapter 6: Making Your Python Code Run Faster

](https://tyr.fyi/6)

  • 4. When to optimize
  • 9. Profiling
  • 10. py-spy
  • 14. Vectorization
  • 23. Numba
  • 28. For-loops in Numba
  • 29. @jit and @njit
  • 31. Types
  • 34. Preallocation
  • 36. Incremental development
  • 37. Matrix multiplication
  • 39. The Ten Suggestions for working with Numba
  • 43. Other optimzation methods
  • 45. Monitoring
  • 46. Choosing a metric
  • 49. Aggregate metrics
  • 52. A separate monitoring process
  • 57. The Dashboard
  • 63. Robust multi-process shutdown