{"id":7743,"date":"2025-10-16T14:22:36","date_gmt":"2025-10-16T14:22:36","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=7743"},"modified":"2025-10-16T14:22:36","modified_gmt":"2025-10-16T14:22:36","slug":"a-newbies-information-to-robotics-with-python","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=7743","title":{"rendered":"A Newbie\u2019s Information to Robotics with Python"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<h2 class=\"wp-block-heading\">Intro<\/h2>\n<p class=\"wp-block-paragraph\"> that may carry out duties and make selections by replicating or substituting human actions. <strong>Robotics <\/strong>is the scientific subject centered on the design and building of robots. It&#8217;s a multidisciplinary mixture of:<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><strong>Electrical Engineering<\/strong> for sensors and actuators. <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Robotic_sensors\" target=\"_blank\" rel=\"noreferrer noopener\">Sensors<\/a> collect knowledge from the surroundings, changing bodily properties into electrical indicators (like our 5 senses). <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Actuator\" target=\"_blank\" rel=\"noreferrer noopener\">Actuators<\/a> convert these indicators into bodily actions or actions (like our muscle tissue).<\/li>\n<li class=\"wp-block-list-item\"><strong>Mechanical Engineering <\/strong>for the design and motion of the bodily construction.<\/li>\n<li class=\"wp-block-list-item\"><strong>Laptop Science <\/strong>for the AI software program and algorithms.<\/li>\n<\/ul>\n<p class=\"wp-block-paragraph\">Presently, <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.ros.org\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><em>ROS<\/em> (Robotic Working System)<\/strong><\/a><strong> <\/strong>is the principle framework for Robotics that handles all of the completely different components of a robotic (sensors, motors, controllers, cameras\u2026), the place all of the parts alternate knowledge in a modular approach. The <em>ROS <\/em>framework is supposed for actual robotic prototypes, and it may be used with each Python and C++. Given its reputation, there are a lot of libraries constructed on high of <em>ROS<\/em>, like <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/gazebosim.org\/home\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><em>Gazebo<\/em><\/strong><\/a>, essentially the most superior 3D simulator.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1280\/0*vRCQC5RvusSRfeoe\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Picture by <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/unsplash.com\/@simonkadula?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Simon Kadula<\/a> on\u00a0<a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/unsplash.com?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">Since <em>Gazebo <\/em>is kind of sophisticated, one can nonetheless be taught the fundamentals of Robotics and construct user-friendly simulations <strong>exterior the <em>ROS <\/em>ecosystem<\/strong>. The principle Python libraries are:\u00a0<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/pybullet.org\/wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><em>PyBullet<\/em><\/strong><\/a><strong> <\/strong>(freshmen)\u200a\u2014\u200anice for experimenting with URDF (Unified Robotic Description Format), which is the XML schema for describing robotic our bodies, components, and geometry.<\/li>\n<li class=\"wp-block-list-item\"><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/cyberbotics.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><em>Webots<\/em><\/strong><\/a><strong> <\/strong>(intermediate)\u200a\u2014\u200athe physics is extra correct, so it may well construct extra complicated simulations.<\/li>\n<li class=\"wp-block-list-item\"><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/mujoco.org\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><em>MuJoCo<\/em><\/strong><\/a><strong> <\/strong>(superior)\u200a\u2014\u200aactual world simulator, it\u2019s used for research-grade experiments. OpenAI\u2019s <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/openai\/robogym\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><em>RoboGYM<\/em><\/strong><\/a> library is constructed on high of <em>MuJoCo<\/em>.<\/li>\n<\/ul>\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/Oct-12-2025-10-10-55.gif\" alt=\"\" class=\"wp-image-625278\" style=\"width:552px;height:auto\"\/><figcaption class=\"wp-element-caption\">I created this visualization with <em>PyBullet<\/em><\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\">Since it is a tutorial for freshmen, I\u2019m going to indicate learn how to\u00a0<strong>construct easy 3D simulations with <em>PyBullet<\/em><\/strong>. I&#8217;ll current some helpful Python code that may be simply utilized in different comparable instances (simply copy, paste, run) and stroll by way of each line of code with feedback to be able to replicate this instance.<\/p>\n<h2 class=\"wp-block-heading\">Setup<\/h2>\n<p class=\"wp-block-paragraph\"><em>PyBullet<\/em> is essentially the most user-friendly physics simulator for video games, visible results, Robotics, and Reinforcement Studying. You&#8217;ll be able to simply set up it with one of many following instructions (if <em>pip<\/em> fails, <em>conda<\/em> ought to positively work):<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">pip set up pybullet\n\nconda set up -c conda-forge pybullet<\/code><\/pre>\n<p class=\"wp-block-paragraph\">You&#8217;ll be able to run <em>PyBullet<\/em> in two primary modes:<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><code>p.GUI<\/code> \u2192 opens a window and exhibits the simulation in actual time.<\/li>\n<li class=\"wp-block-list-item\"><code>p.DIRECT<\/code> \u2192 no graphics mode, used for scripts.<\/li>\n<\/ul>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import pybullet as p\n\np.join(p.GUI)  #or p.join(p.DIRECT) <\/code><\/pre>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/image-131.png\" alt=\"\" class=\"wp-image-625279\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Since it is a physics simulator, the very first thing to do is ready up <strong>gravity<\/strong>:<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">p.resetSimulation()\n\np.setGravity(gravX=0, gravY=0, gravZ=-9.8)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Units the worldwide gravity vector for the simulation. \u201c-9.8\u201d on the z-axis means an acceleration of <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Gravity_of_Earth\"><em>9.8 m\/s^2<\/em> downward<\/a>, similar to on Earth. With out this, your robotic and aircraft would float in zero-gravity, similar to in house.<\/p>\n<h2 class=\"wp-block-heading\">URDF file<\/h2>\n<p class=\"wp-block-paragraph\">If the robotic was a human physique, the <strong>URDF<\/strong> <strong>file<\/strong> can be the skeleton that defines its bodily construction. It\u2019s written in XML, and it\u2019s mainly the<strong> <\/strong>blueprint for the machine, defining what your robotic appears like and the way it strikes.<\/p>\n<p class=\"wp-block-paragraph\">I\u2019m going to indicate learn how to create a <strong>easy dice<\/strong>, which is the 3D equal of <em>print(\u201cwhats up world\u201d)<\/em>.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">urdf_string = \"\"\"\"\n<robot name=\"&quot;cube_urdf&quot;\">\n\n  <link name=\"&quot;cube_link&quot;\"\/>\n    <visual>\n      <geometry>\n        <box size=\"&quot;0.5\"\/> \n      <\/geometry>\n      <material name=\"&quot;blue&quot;\">\n        <color rgba=\"&quot;0\"\/>\n      <\/material>\n    <\/visual>\n\n    <collision>\n      <geometry>\n        <box size=\"&quot;0.5\"\/>\n      <\/geometry>\n    <\/collision>\n\n    <inertial>\n      <mass value=\"&quot;1.0&quot;\/\">\n      <inertia ixx=\"&quot;0.0001&quot;\" iyy=\"&quot;0.0001&quot;\" izz=\"&quot;0.0001&quot;\" ixy=\"&quot;0.0&quot;\" ixz=\"&quot;0.0&quot;\" iyz=\"&quot;0.0&quot;\/\">\n    <\/inertia><\/mass><\/inertial>\n  \n<\/robot>\n\"\"\"<\/code><\/pre>\n<p class=\"wp-block-paragraph\">You&#8217;ll be able to both save the XLM code as a URDF file or use it as a string.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import pybullet as p\nimport tempfile\n\n## setup\np.join(p.GUI)\np.resetSimulation()\np.setGravity(gravX=0, gravY=0, gravZ=-9.8)\n\n## create a brief URDF file in reminiscence\nwith tempfile.NamedTemporaryFile(suffix=\".urdf\", mode=\"w\", delete=False) as f:\n    f.write(urdf_string)\n    urdf_file = f.identify\n\n## load URDF\np.loadURDF(fileName=urdf_file, basePosition=[0,0,1])\n\n## render simulation\nfor _ in vary(240): \n    p.stepSimulation()<\/code><\/pre>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/image-132.png\" alt=\"\" class=\"wp-image-625280\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Please notice that the loop did run with 240 steps. <strong>Why 240?<\/strong> It\u2019s a set timestep generally utilized in videogame improvement for a clean and responsive expertise with out overtaxing the CPU. 60 FPS (frames per second) with 1 body displayed each 1\/60 of a second, which signifies that a physics step of 1\/240 seconds gives 4 physics updates for each rendered body.<\/p>\n<p class=\"wp-block-paragraph\">Within the earlier code, I rendered the dice with <code>p.stepSimulation()<\/code>. It signifies that the simulation just isn&#8217;t in real-time and also you management when the following physics step occurs. Alternatively, you could possibly use <em>time sleep<\/em> to bind it to the true world clock.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import time\n\n## render simulation\nfor _ in vary(240):\n    p.stepSimulation() #add a physics step (CPU pace = 0.1 second)\n    time.sleep(1\/240)  #decelerate to real-time (240 steps \u00d7 1\/240 second sleep = 1 second)<\/code><\/pre>\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/Oct-12-2025-12-36-46.gif\" alt=\"\" class=\"wp-image-625282\" style=\"width:566px;height:auto\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Going ahead, the XML code for robots will get way more sophisticated. Fortunately, <em>PyBullet<\/em> comes with a group of preset URDF information. You&#8217;ll be able to simply load the default dice with out creating the XML for it.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import pybullet_data\n\np.setAdditionalSearchPath(path=pybullet_data.getDataPath())\n\np.loadURDF(fileName=\"dice.urdf\", basePosition=[0,0,1])<\/code><\/pre>\n<p class=\"wp-block-paragraph\">At its core, a URDF file defines two primary issues: <strong>hyperlinks <\/strong>and<strong> joints<\/strong>. Hyperlinks are the stable a part of the robots (like our bones), and a joint is the connection between two inflexible hyperlinks (like our muscle tissue). With out joints, your robotic can be only a statue, however with joints it turns into a machine with movement and goal.<\/p>\n<p class=\"wp-block-paragraph\">In a nutshell, each robotic is a tree of hyperlinks linked by joints. Every joint could be mounted (no motion) or rotate (\u201crevolute joint\u201d) and slide (\u201cprismatic joint\u201d). Due to this fact, you could know the robotic you\u2019re utilizing. <\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s make an instance with the well-known robotic R2D2 from Star Wars.<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/image-1-1024x682.jpeg\" alt=\"\" class=\"wp-image-625291\"\/><figcaption class=\"wp-element-caption\">Picture by <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/unsplash.com\/@irrabagon?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Alexandr Popadin<\/a> on\u00a0<a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/unsplash.com?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\">Joints<\/h2>\n<p class=\"wp-block-paragraph\">This time, we now have to <strong>import a aircraft<\/strong> as nicely to be able to create a floor for the robotic. With no aircraft, objects wouldn&#8217;t have a floor to collide with and they&#8217;d simply fall indefinitely.\u00a0<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">## setup\np.join(p.GUI)\np.resetSimulation()\np.setGravity(gravX=0, gravY=0, gravZ=-9.8)\np.setAdditionalSearchPath(path=pybullet_data.getDataPath())\n\n## load URDF\naircraft = p.loadURDF(\"aircraft.urdf\")\nrobo = p.loadURDF(fileName=\"r2d2.urdf\", basePosition=[0,0,0.1])\n\n## render simulation\nfor _ in vary(240):\n    p.stepSimulation()\n    time.sleep(1\/240)\n\np.disconnect()<\/code><\/pre>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/image-133.png\" alt=\"\" class=\"wp-image-625296\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Earlier than utilizing the robotic, we should perceive its parts. <em>PyBullet<\/em> has standardized the data construction so that each robotic you import shall at all times be outlined by the identical <strong>17 common attributes<\/strong>. Since I simply wish to run a script, I\u2019m going to hook up with the physics server with out the graphic interface (<code>p.DIRECT<\/code>). The principle perform to research a joint is <code>p.getJointInfo()<\/code>.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">p.join(p.DIRECT)\n\ndic_info = {\n    0:\"joint Index\",  #begins at 0\n    1:\"joint Title\",\n    2:\"joint Sort\",  #0=revolute (rotational), 1=prismatic (sliding), 4=mounted\n    3:\"state vectorIndex\",\n    4:\"velocity vectorIndex\",\n    5:\"flags\",  #nvm at all times 0\n    6:\"joint Damping\",  \n    7:\"joint Friction\",  #coefficient\n    8:\"joint lowerLimit\",  #min angle\n    9:\"joint upperLimit\",  #max angle\n    10:\"joint maxForce\",  #max drive allowed\n    11:\"joint maxVelocity\",  #max pace\n    12:\"hyperlink Title\",  #little one hyperlink linked to this joint\n    13:\"joint Axis\",\n    14:\"guardian FramePos\",  #place\n    15:\"guardian FrameOrn\",  #orientation\n    16:\"guardian Index\"  #\u22121 = base\n}\nfor i in vary(p.getNumJoints(bodyUniqueId=robo)):\n    print(f\"--- JOINT {i} ---\")\n    joint_info = p.getJointInfo(bodyUniqueId=robo, jointIndex=i)\n    print({dic_info[k]:joint_info[k] for okay in dic_info.keys()})<\/code><\/pre>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/image-142-1024x187.png\" alt=\"\" class=\"wp-image-625361\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Each joint, irrespective of if it\u2019s a wheel, elbow, or gripper, has to show those self same options. The code above exhibits that R2D2 has 15 joints. Let\u2019s analyze the primary one, known as \u201cbase to right-leg\u201d:<\/p>\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">The <strong>joint kind<\/strong> is 4, which implies it doesn\u2019t transfer. The <strong>guardian hyperlink<\/strong> is -1, which implies it&#8217;s linked to the <strong>base<\/strong>, the basis a part of the robotic (like our skeleton backbone). For R2D2, the bottom is the principle cylindrical physique, that large blue and white barrel.<\/li>\n<li class=\"wp-block-list-item\">The <strong>hyperlink identify<\/strong> is \u201cproper leg\u201d, so we perceive that this joint connects the robotic\u2019s base with the fitting leg, nevertheless it\u2019s not motorized. That&#8217;s confirmed by <strong>joint axis<\/strong>, <strong>joint dumping<\/strong>, and <strong>joint friction<\/strong> being all zeros.<\/li>\n<li class=\"wp-block-list-item\"><strong>Guardian body place<\/strong> and <strong>orientation <\/strong>outline the place the fitting leg is connected to the bottom.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\">Hyperlinks<\/h2>\n<p class=\"wp-block-paragraph\">Alternatively, to be able to analyze the hyperlinks (the bodily physique segments), one should loop by way of the joints to extract the hyperlink identify. Then, you should utilize two primary features:<code> p.getDynamicsInfo()<\/code> to grasp the bodily properties of the hyperlink, and <code>p.getLinkState()<\/code> to know its spatial state.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">p.join(p.DIRECT)\n\nfor i in vary(p.getNumJoints(robo)):\n    link_name = p.getJointInfo(robo, i)[12].decode('utf-8')  #subject 12=\"hyperlink Title\"\n    dyn = p.getDynamicsInfo(robo, i)\n    pos, orn, *_ = p.getLinkState(robo, i)\n    dic_info = {\"Mass\":dyn[0], \"Friction\":dyn[1], \"Place\":pos, \"Orientation\":orn}\n    print(f\"--- LINK {i}: {link_name} ---\")\n    print(dic_info)<\/code><\/pre>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/image-150-1024x124.png\" alt=\"\" class=\"wp-image-625452\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Let\u2019s analyze the primary one, the \u201cright-leg\u201d. The <strong>mass <\/strong>of 10 kg contributes to gravity and inertia, whereas the <strong>friction<\/strong> impacts how a lot it slides when contacting the bottom. The <strong>orientation <\/strong>(0.707=<em>sin(45\u00b0)\/cos(45\u00b0)<\/em>) and <strong>place <\/strong>point out that the right-leg hyperlink is a stable piece, barely ahead (5cm), tilted 90\u00b0 relative to the bottom.<\/p>\n<h2 class=\"wp-block-heading\">Actions<\/h2>\n<p class=\"wp-block-paragraph\">Let\u2019s take a look at a joint that may truly transfer. <\/p>\n<p class=\"wp-block-paragraph\">For istance, joint 2 is the fitting entrance wheel. It\u2019s a sort=0 joint, so it rotates. This joint connects the fitting leg (hyperlink index 1) to the fitting entrance wheel: base_link \u2192 right_leg \u2192 right_front_wheel. The joint axis is (0,0,1), so we all know that the wheel spins across the z-axis. The bounds (decrease=0, higher=-1) point out that the wheel can spin infinitely, which is regular for rotors.<\/p>\n<p class=\"wp-block-paragraph\">We will simply <strong>transfer this joint<\/strong>. The principle command for controlling actuators in your robotic is <code>p.setJointMotorControl2()<\/code>, it permits to regulate the drive, velocity, and place of a joint. On this case, I wish to make the wheel spin, so I&#8217;ll <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Newton%27s_laws_of_motion\">apply drive to steadily carry the speed from zero to a goal velocity, then keep it by balancing utilized drive and resistive forces<\/a> (i.e. friction, damping, gravity).<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">p.setJointMotorControl2(bodyUniqueId=robo, jointIndex=2,\n                        controlMode=p.VELOCITY_CONTROL, \n                        targetVelocity=10, drive=5)<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Now, if we apply the identical drive to <strong>all of the 4 wheels<\/strong>, we are going to make our little robotic transfer ahead. From the evaluation carried out earlier, we all know that the joints for the wheel are quantity 2 and three (proper facet), and quantity 6 and seven (left facet).<\/p>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/image-151-1024x547.png\" alt=\"\" class=\"wp-image-625454\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Contemplating that, I shall first make R2D2 flip round by spinning just one facet, after which apply drive to each wheel on the similar time to make it transfer ahead.<\/p>\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-python\">import pybullet as p\nimport pybullet_data\nimport time\n\n## setup\np.join(p.GUI)\np.resetSimulation()\np.setGravity(gravX=0, gravY=0, gravZ=-9.8)\np.setAdditionalSearchPath(path=pybullet_data.getDataPath())\n\n## load URDF\naircraft = p.loadURDF(\"aircraft.urdf\")\nrobo = p.loadURDF(fileName=\"r2d2.urdf\", basePosition=[0,0,0.1])\n\n## quiet down\nfor _ in vary(240):\n    p.stepSimulation()\n\nright_wheels = [2,3]\nleft_wheels = [6,7]\n\n### first flip\nfor _ in vary(240):\n    for j in right_wheels:\n        p.setJointMotorControl2(bodyUniqueId=robo, jointIndex=j,\n                                controlMode=p.VELOCITY_CONTROL, \n                                targetVelocity=-100, drive=50)\n    for j in left_wheels:\n        p.setJointMotorControl2(bodyUniqueId=robo, jointIndex=j,\n                                controlMode=p.VELOCITY_CONTROL, \n                                targetVelocity=100, drive=50)\n    p.stepSimulation()\n    time.sleep(1\/240)\n\n### then transfer ahead\nfor _ in vary(500):   \n    for j in right_wheels + left_wheels:\n        p.setJointMotorControl2(bodyUniqueId=robo, jointIndex=j,\n                                controlMode=p.VELOCITY_CONTROL, \n                                targetVelocity=-100, drive=10)\n    p.stepSimulation()\n    time.sleep(1\/240)\n\np.disconnect()<\/code><\/pre>\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/Oct-13-2025-20-36-10.gif\" alt=\"\" class=\"wp-image-625383\" style=\"width:505px;height:auto\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Please notice that each robotic has a special mass (weight) so the actions could be completely different primarily based on the simulation physics (i.e. gravity). You&#8217;ll be able to play and take a look at completely different drive and velocity till you discover the specified consequence.<\/p>\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/10\/r2d2.gif\" alt=\"\" class=\"wp-image-625497\" style=\"width:511px;height:auto\"\/><\/figure>\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n<p class=\"wp-block-paragraph\">This text has been a tutorial to\u00a0<strong>introduce PyBullet and learn how to create very fundamental 3D simulations<\/strong> <strong>for Robotics<\/strong>. We discovered learn how to import URDF objects and learn how to analyze joints and hyperlinks. We additionally performed with the well-known robotic R2D2. New tutorials with extra superior robots will come.<\/p>\n<p class=\"wp-block-paragraph\">Full code for this text:\u00a0<strong><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/mdipietro09\/RoboticsPy\">GitHub<\/a><\/strong><\/p>\n<p class=\"wp-block-paragraph\">I hope you loved it! Be happy to contact me for questions and suggestions or simply to share your attention-grabbing tasks.<\/p>\n<p class=\"has-text-align-center wp-block-paragraph\">\ud83d\udc49\u00a0<a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/maurodp.carrd.co\/\"><strong>Let\u2019s Join<\/strong><\/a>\u00a0\ud83d\udc48<\/p>\n<figure class=\"wp-block-image\"><img data-dominant-color=\"c1cab4\" data-has-transparency=\"false\" style=\"--dominant-color: #c1cab4;\" decoding=\"async\" src=\"https:\/\/contributor.insightmediagroup.io\/wp-content\/uploads\/2025\/06\/1LgqxDMP5qD1HE_uM33zZrg.png\" alt=\"\" class=\"wp-image-605756 not-transparent\"\/><\/figure>\n<p class=\"has-text-align-center wp-block-paragraph\"><sub><sup>(All photographs are by the writer until in any other case<\/sup><\/sub><sub><sup>\u00a0famous)<\/sup><\/sub><\/p>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Intro that may carry out duties and make selections by replicating or substituting human actions. Robotics is the scientific subject centered on the design and building of robots. It&#8217;s a multidisciplinary mixture of: Electrical Engineering for sensors and actuators. Sensors collect knowledge from the surroundings, changing bodily properties into electrical indicators (like our 5 senses). [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":7745,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[2785,78,1258,718],"class_list":["post-7743","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-beginners","tag-guide","tag-python","tag-robotics"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/7743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7743"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/7743\/revisions"}],"predecessor-version":[{"id":7744,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/7743\/revisions\/7744"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/7745"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69d9690a190636c2e0989534. Config Timestamp: 2026-04-10 21:18:02 UTC, Cached Timestamp: 2026-08-05 08:54:56 UTC -->