{"id":159,"date":"2010-02-16T14:49:14","date_gmt":"2010-02-16T19:49:14","guid":{"rendered":"http:\/\/ammonsengineering.com\/blog\/?p=159"},"modified":"2010-02-18T15:26:47","modified_gmt":"2010-02-18T20:26:47","slug":"pendulum-position-and-speed","status":"publish","type":"post","link":"https:\/\/ammonsengineering.com\/blog\/2010\/02\/pendulum-position-and-speed\/","title":{"rendered":"Pendulum position and speed"},"content":{"rendered":"<p>I wired up the encoder for the pendulum and ran a few tests.\u00a0 It was a major pain to solder the wires into the connector.\u00a0 The connector is so small and light that it slides all over the place while I am trying to heat up the solder cup and insert the wire.\u00a0 I melted a big section of the plastic connector base while chasing the connector around.\u00a0\u00a0I ended up plugging the connector into the 9411 module to give it more bulk and managed to complete the job.\u00a0 It is pretty messy, though.\u00a0 I decided I need to buy a small vise to hold the parts while I am soldering.\u00a0 This will make it much easier.\u00a0 I found a few in the $20 range that look pretty good.<\/p>\n<p>Once I wired it up, I tried out a copy of the position and speed measurement routines that I used for the cart.\u00a0 I quickly found a major bug in the algorithm &#8211; I was storing the space measurements as signed values, and when it was changing direction I was averaging large positive and negative numbers, which gives numbers close to zero.\u00a0 After division, I was getting very large speeds instead of close to zero like I should.\u00a0 I separated the signs from the magnitudes and everything was good.\u00a0 I tweaked a few other parts of the algorithm to get very accurate measurements.\u00a0 I found the pendulum encoder still has a pattern that repeats every four pulses, but it isn&#8217;t nearly as bad as the position encoder.\u00a0 At higher speeds averaging four spaces works very well to give a smooth speed measurement.\u00a0 At very low speeds, it is better to use single measurement to minimize the delay of the speed measurement.<\/p>\n<p>Once I was satisfied with the measurements for the pendulum, I copied the changes back to the cart routines.\u00a0 They probably still need a little tweaking since the cart behaves differently than the pendulum, but it should still be an improvement since I eliminated some major bugs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wired up the encoder for the pendulum and ran a few tests.\u00a0 It was a major pain to solder the wires into the connector.\u00a0 The connector is so small and light that it slides all over the place while I am trying to heat up the solder cup and insert the wire.\u00a0 I melted [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-software"],"_links":{"self":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":3,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":176,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts\/159\/revisions\/176"}],"wp:attachment":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}