<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Someone. </title>
    <description>The latest articles on DEV Community by Someone.  (@somespi).</description>
    <link>https://dev.to/somespi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F989494%2F6b4162b0-5e8b-4bb3-bcfe-7300d7940d1d.jpeg</url>
      <title>DEV Community: Someone. </title>
      <link>https://dev.to/somespi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/somespi"/>
    <language>en</language>
    <item>
      <title>DEVLOG – How to Move Straight in a Line?</title>
      <dc:creator>Someone. </dc:creator>
      <pubDate>Sun, 14 Dec 2025 00:36:07 +0000</pubDate>
      <link>https://dev.to/somespi/devlog-how-to-move-straight-in-a-line-3dc0</link>
      <guid>https://dev.to/somespi/devlog-how-to-move-straight-in-a-line-3dc0</guid>
      <description>&lt;p&gt;Getting a small robot (SPIKE Prime, in my case) to move in a straight line is harder than it looks. &lt;/p&gt;

&lt;p&gt;Thus, methods such as PID exist, but I didn't want to use such complicated (and not 100% understood) algorithms just because it's there (Notice that I did not do any research, this was all trail-and-error work). &lt;/p&gt;

&lt;h1&gt;
  
  
  Problem Statement
&lt;/h1&gt;

&lt;p&gt;To cope with any problem, we first need to tailor it into a problem statement that is explicit and understandable, so here's ours: &lt;em&gt;"How can I make a SPIKE Prime robot move X distance in a straight line, while pulling an external load?"&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Center of Mass
&lt;/h1&gt;

&lt;p&gt;It may seem obvious,"Just let it move 0 degrees!", you might say. However, the center of mass (the point at which the total mass of the object is concentrated) is not always in the center. In fact, only regular bodies have their center of mass coinciding with the geometric center; for all other objects, these points do not coincide. &lt;/p&gt;

&lt;p&gt;Therefore, commanding the robot to move at angle 0, will let it tilt over time.&lt;/p&gt;

&lt;h1&gt;
  
  
  PROPOSAL #1: MOVE(0 - YAW)
&lt;/h1&gt;

&lt;p&gt;My initial idea was to let the robot move (0 - yaw) degrees, That is, ensuring that whenever the robot detects any tilting (by it's internal gyroscope), it readjusts accordingly. &lt;/p&gt;

&lt;p&gt;However, due to the robot programming limitations, I needed this function to run in a loop, and loops do not support "MOVE UNTIL X DISTANCE", so I had to find a way to move it with a time. Thus, I came up with this idea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start a timer (T)&lt;/li&gt;
&lt;li&gt;Let the robot move X cm at 0 degrees.&lt;/li&gt;
&lt;li&gt;Let speed = X ÷ T&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the not on the required path, as the track have many tasks:&lt;br&gt;
1 - Move to point A-B straight &lt;br&gt;
2 - Move to point B-C with a load. &lt;/p&gt;

&lt;p&gt;so, for task 1, the robot can move in a straight line due to the short distance and that there no external load. Thus, we can calculate the speed of the robot. &lt;/p&gt;

&lt;p&gt;Then, for task 2, we need to run a loop for the MOVE(0 - YAW) method to work, and to get the required time the robot needs to run to go to X distance, we can do: time = d/v, which we already have d and v. &lt;/p&gt;

&lt;h1&gt;
  
  
  PROPOSAL #2: Displacement-based Movement
&lt;/h1&gt;

&lt;p&gt;The first proposal introduced a way to move in a straight line, however, since the robot doesn't move in a linear movement, but in tilting (0 - yaw) movement, Time becomes obsolete, as the total distance will increase, time needed will also increase. &lt;/p&gt;

&lt;p&gt;So, instead of relying on time, we track the actual straight-line displacement of the robot from its starting point. This means we care only about the distance “as the crow flies,” not the total path traveled, which may curve slightly due to tilting.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Initialize a vector position (Rx, Ry) at (0, 0).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every small time interval (tick): &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Measure how far the robot moved since the last tick. This can be done via the wheel encoders.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Read the current yaw angle from the gyroscope.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the vector position along the direction of motion:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rx = Rx + A × cos(yaw)&lt;br&gt;&lt;br&gt;
Ry = Ry + A × sin(yaw)&lt;/p&gt;

&lt;p&gt;Here, A is the distance moved in this tick, computed from the wheel rotation (or, A = v × t).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Calculate the straight-line displacement: R = sqrt(Rx^2 + Ry^2) &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stop the robot when R ≥ X, where X is the desired straight-line distance.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While this is theoretically correct, it didn't work out due to the robot limitations! Well... I guess back to PID 😄.&lt;/p&gt;

</description>
      <category>robotics</category>
      <category>algorithms</category>
      <category>physics</category>
    </item>
    <item>
      <title>Python Dunder Functions: What They Are and How to Use Them</title>
      <dc:creator>Someone. </dc:creator>
      <pubDate>Sat, 11 Mar 2023 13:27:19 +0000</pubDate>
      <link>https://dev.to/somespi/python-dunder-functions-what-they-are-and-how-to-use-them-1lom</link>
      <guid>https://dev.to/somespi/python-dunder-functions-what-they-are-and-how-to-use-them-1lom</guid>
      <description>&lt;p&gt;Dunder functions are special methods in Python that begin and end with a double underscore (e.g. init, str). They are also known as magic methods or special methods. In this post, we'll explore what dunder functions are, what they're used for, and how to use them in your Python code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Dunder Functions?
&lt;/h2&gt;

&lt;p&gt;Dunder functions are pre-defined methods in Python that have special meanings. They are called "dunder" functions because their names begin and end with double underscores (i.e. "__"). These functions are also called magic methods because they allow Python classes to emulate built-in types and perform various operations, such as object initialization, comparison, and iteration.&lt;/p&gt;

&lt;p&gt;Dunder functions are not called directly like regular methods. Instead, they are invoked implicitly by Python in response to certain events or operators. For example, the str method is called when you use the str() function on an object, or when you use the print() function to output the object.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use Dunder Functions
&lt;/h2&gt;

&lt;p&gt;To use a dunder function, you simply define it in your Python class. Here's an example of a class with a str method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__str__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; years old"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we define a Person class with an init method that initializes the name and age attributes, and a str method that returns a string representation of the object. To use this class, we can create instances of it and then print them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;p1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Alice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;p2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Bob"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Output: Alice, 25 years old
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Output: Bob, 30 years old
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we print the Person objects, Python calls the str method implicitly to get their string representation.&lt;/p&gt;

&lt;p&gt;Here are some other common dunder functions and their uses:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`__init__`: Initializes an object when it is created. This method is called immediately after an object is created and allows you to set the initial values for the object's attributes.

`__eq__`: Defines the behavior of the == operator. This method is called when you use the == operator to compare two objects of the same class.

`__lt__`: Defines the behavior of the &amp;lt; operator. This method is called when you use the &amp;lt; operator to compare two objects of the same class.

`__len__`: Returns the length of the object. This method is called when you use the len() function on an object.

`__repr__`: Returns a string representation of the object that can be used to recreate it. This method is called when you use the `repr()` function on an object.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can define other dunder functions in your classes as well, depending on your needs. For example, you can define a add method to specify the behavior of the + operator for your class.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Dunder Functions
&lt;/h2&gt;

&lt;p&gt;Using dunder functions can make your code more concise and easier to read, as well as more powerful and flexible. By defining these special methods, you can make your classes behave like built-in types, and you can control how they respond to operators and events. This can make your code more intuitive and easier to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Dunder functions are a powerful feature of Python that allow you to customize.&lt;/p&gt;

</description>
      <category>python</category>
      <category>productivity</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Is Python a programming?</title>
      <dc:creator>Someone. </dc:creator>
      <pubDate>Sat, 11 Mar 2023 13:21:06 +0000</pubDate>
      <link>https://dev.to/somespi/is-python-a-programming-43lb</link>
      <guid>https://dev.to/somespi/is-python-a-programming-43lb</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello , this article is indicated in it's title, even if the title is not clear, we will talk about "Why some people don't want to learn python".&lt;br&gt;
In this article, we will discuss several pens, the most important of them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is python?&lt;/li&gt;
&lt;li&gt;Is python that easy?&lt;/li&gt;
&lt;li&gt;Is it really a language?&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  What is Python?
&lt;/h2&gt;

&lt;p&gt;Python is a high-level, interpreted programming language that was created by &lt;a href=""&gt;Guido van Rossum&lt;/a&gt; and first released in 1991.&lt;br&gt;
&lt;strong&gt;It has a design philosophy that emphasizes code readability&lt;/strong&gt;, and its syntax allows programmers to express concepts in fewer lines of code than in languages such as &lt;em&gt;C++&lt;/em&gt; or &lt;em&gt;Java&lt;/em&gt;.&lt;br&gt;
Python has become one of the most popular programming languages in the world, used for &lt;em&gt;web development&lt;/em&gt;, &lt;em&gt;data analysis&lt;/em&gt;, &lt;em&gt;artificial intelligence&lt;/em&gt;, and many other fields.&lt;/p&gt;




&lt;h2&gt;
  
  
  Is Python that easy?
&lt;/h2&gt;

&lt;p&gt;Python is often touted as an easy language to learn, particularly for beginners. Its syntax is straightforward and readable, and its built-in libraries and frameworks make it simple to accomplish many common programming tasks.&lt;br&gt;
However, like any programming language, Python still requires effort and practice to master.&lt;br&gt;
It's not a magic bullet that will make programming easy for everyone, but it is an accessible language that can help people get started with coding.&lt;/p&gt;




&lt;h2&gt;
  
  
  Is it really a language?
&lt;/h2&gt;

&lt;p&gt;Some people argue that Python is not a "real" programming language because it is interpreted rather than compiled. However, this is a misconception.&lt;br&gt;
Python is a fully-featured programming language that can be used to create complex applications, just like any other language.&lt;br&gt;
The fact that it is interpreted means that it can be slower than compiled languages in some cases, but it also has benefits such as being more flexible and easier to debug.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, Python is a powerful and versatile programming language that has become hugely popular in recent years.&lt;br&gt;
While it may not be the best choice for every situation, it is a language that is worth learning for anyone who wants to become a programmer or work in a field that requires coding skills.&lt;br&gt;
Despite some misconceptions about its ease of use and status as a "real" language, Python has proven itself to be a valuable tool for developers around the world.&lt;/p&gt;

</description>
      <category>microsoft</category>
      <category>github</category>
      <category>community</category>
    </item>
  </channel>
</rss>
