<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How ROS is used in mechArm 270?]]></title><description><![CDATA[<p dir="auto">As an open-source meta-operating system used for robots, ROS is widely used in many robotics products, also in <a href="https://shop.elephantrobotics.com/collections/mecharm" target="_blank" rel="noopener noreferrer nofollow ugc">mechArm 270-Pi</a>. Through the ROS system, we can simulate the control of robotic arms in a virtual environment. We will visualize robot arms through <strong>rviz</strong>, operates our robot arms in a variety of ways, and also plan and execute the action path through <strong>Moveit</strong> to control the mechArm. Now we will talk about how to control mechArm 270-Pi in <strong>rviz</strong> and <strong>Moveit</strong>.</p>
<p dir="auto"><strong>rviz</strong><br />
rviz is a 3D visualization platform in ROS. It can graphically display external information. Meanwhile, we can also get the controlling information to an object through rviz, and realize the monitoring and control of a robot, such as the control of slider, GUI and keyboard, and model following. Here we're going to demonstrate how to implement these functions.</p>
<p dir="auto"><strong>1.Slider Control</strong><br />
Open a terminal or command line and run :</p>
<pre><code># The default serial port name of the mechArm version is "/dev/ttyAMA0", and the baud rate is 1000000".
roslaunch mecharm_pi slider_control.launch port:=/dev/ttyAMA0 baud:=1000000
</code></pre>
<p dir="auto">rviz and a slider component will be opened, and we will see the following interface:<br />
<img src="/assets/uploads/files/1655802447802-2.6.4ros-resized.png" alt="0_1655802447038_2.6.4ROS.png" class=" img-fluid img-markdown" /><br />
Then we can control the model in rviz to make it move by dragging the slider. If we want the real mechArm to move with the model, we need to open another command line and run:</p>
<pre><code># The default serial port name of the mechArm version is "/dev/ttyAMA0", and the baud rate is 1000000".
rosrun mecharm_pi slider_control.py _port:=/dev/ttyAMA0 _baud:=1000000
</code></pre>
<p dir="auto">Note: Since the robot arm will move to the current position of the model when the command is input, make sure that the model in rviz does not appear to be worn out before we use the command.</p>
<p dir="auto">Note: Do not drag the slider immediately and too quickly after connecting the mechArm to prevent damages to the robot arm.</p>
<p dir="auto"><strong>2.GUI control</strong><br />
Based on the previous contents, this package also provides a simple GUI control interface. This method is used to control the real robot arms. We should connect to mecharm first.</p>
<p dir="auto">Open a command line:</p>
<pre><code># The default serial port name of the mechArm version is "/dev/ttyAMA0", and the baud rate is 1000000".
roslaunch mecharm_pi simple_gui.launch port:=/dev/ttyAMA0 baud:=1000000
</code></pre>
<p dir="auto">Running effect:<br />
<img src="/assets/uploads/files/1655802329292-gui-resized.jpg" alt="0_1655802328353_GUI.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto"><strong>3.Keyboard control</strong><br />
Keyboard control is added in <code>mecharm</code> package, and real-time Synchronization is performed in rviz. This function depends on pythonApi, so be sure to connect with the real robot arm.</p>
<p dir="auto">Open a command line and run:</p>
<pre><code># The default serial port name of the mechArm version is "/dev/ttyAMA0", and the baud rate is 1000000".
roslaunch mecharm_pi teleop_keyboard.launch port:=/dev/ttyAMA0 baud:=1000000
</code></pre>
<p dir="auto">Running effect is as follows:<br />
<img src="/assets/uploads/files/1655802405650-mecharm_teleop-resized.png" alt="0_1655802404850_mecharm_teleop.png" class=" img-fluid img-markdown" /><br />
We can control the mechArm by keyboard as instructed in the command line, mechArm information will be output in the command line as follows:</p>
<pre><code>SUMMARY
========

PARAMETERS
 * /mecharm_services/baud: 1000000
 * /mecharm_services/port: /dev/ttyAMA0
 * /robot_description: &lt;?xml version="1....
 * /rosdistro: melodic
 * /rosversion: 1.14.11

NODES
  /
    mecharm_services (mecharm_communication/mypal_services.py)
    real_listener (mecharm_pi/listen_real.py)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    rviz (rviz/rviz)

ROS_MASTER_URI=http://localhost:11311

process[robot_state_publisher-1]: started with pid [14764]
process[rviz-2]: started with pid [14765]
process[mecharm_services-3]: started with pid [14766]
process[real_listener-4]: started with pid [14782]
[INFO] [1646649869.148017]: start ...
[INFO] [1646649869.156531]: /dev/ttyAMA0,1000000

Mycobot Status
--------------------------------
Joint Limit:
    joint 1: -160 ~ +160
    joint 2: -90 ~ +90
    joint 3: -180 ~ +45
    joint 4: -160 ~ +160
    joint 5: -100 ~ +100
    joint 6: -180 ~ +180

Connect Status: True

Servo Infomation: unknown

Servo Temperature: unknown

Atom Version: unknown

[INFO] [1646649869.427899]: ready
</code></pre>
<p dir="auto">Then open another command line and run:</p>
<pre><code>rosrun mecharm_pi teleop_keyboard.py
# or
rosrun mecharm_pi teleop_keyboard.py _speed:=70
</code></pre>
<p dir="auto">We will see the following output in the command line:</p>
<pre><code>mecharm Teleop Keyboard Controller
---------------------------
Movimg options(control coordinations [x,y,z,rx,ry,rz]):
              w(x+)

    a(y-)     s(x-)     d(y+)

        z(z-)       x(z+)

u(rx+)      i(ry+)      o(rz+)
j(rx-)      k(ry-)      l(rz-)

Gripper control:
    g - open
    h - close

Other:
    1 - Go to init pose
    2 - Go to home pose
    3 - Resave home pose
    q - Quit

currently:    speed: 40    change percent: 5
</code></pre>
<p dir="auto">Parameters supported by this script:</p>
<p dir="auto">_speed: the movement speed of the robot arm<br />
_change_percent: movement distance percentage</p>
<p dir="auto"><strong>4.Model Following</strong><br />
In addition, we can also make the model follow the movement of the real robotic arm. Open a command line and run:</p>
<pre><code># The default serial port name of the mechArm version is "/dev/ttyAMA0", and the baud rate is 1000000".
rosrun mecharm_pi follow_display.py _port:=/dev/ttyAMA0 _baud:=1000000
</code></pre>
<p dir="auto">Then open another command line and run:</p>
<pre><code>roslaunch mecharm_pi follow.launch
</code></pre>
<p dir="auto">It will open rviz to show the model following effect.</p>
<p dir="auto"><strong>5.Moveit</strong><br />
As an integrated development platform in ROS, Moveit consists of a variety of functional packages for manipulating robot arms, including motion planning, operation, control, inverse kinematics, 3D perception,  and collision detection.<br />
For mechArm 270-Pi, <code>mycobot_ros</code> has integrated the MoveIt section, so we need to open the command line and run:</p>
<pre><code>roslaunch mecharm_pi_moveit mecharm_moveit.launch
</code></pre>
<p dir="auto">The operation effect is as follows:<br />
<img src="/assets/uploads/files/1655802527368-mecharm_moveit-resized.png" alt="0_1655802526495_mecharm_moveit.png" class=" img-fluid img-markdown" /><br />
If we want a real robot arm to execute a plan synchronously, we need to open another command line and run:</p>
<pre><code># The default serial port name of the mechArm version is "/dev/ttyAMA0", and the baud rate is 1000000".
rosrun mecharm_pi_moveit sync_plan.py _port:=/dev/ttyAMA0 _baud:=1000000
</code></pre>
<p dir="auto">With the support of the ROS system, we can control <a href="https://shop.elephantrobotics.com/collections/mecharm" target="_blank" rel="noopener noreferrer nofollow ugc">mechArm</a> and conduct algorithm verification under a virtual environment, which reduces the requirements for the experimental environment and improves efficiency.</p>
<p dir="auto">Should you have any ideas about using ROS in the robotic arm for more functions, please share with us in the comment.</p>
]]></description><link>https://community.m5stack.com/topic/4380/how-ros-is-used-in-mecharm-270</link><generator>RSS for Node</generator><lastBuildDate>Thu, 30 Apr 2026 06:20:40 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4380.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 Jun 2022 09:09:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How ROS is used in mechArm 270? on Wed, 22 Jun 2022 02:57:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kkkkkk" aria-label="Profile: kkkkkk">@<bdi>kkkkkk</bdi></a> It is  esp32</p>
]]></description><link>https://community.m5stack.com/post/17784</link><guid isPermaLink="true">https://community.m5stack.com/post/17784</guid><dc:creator><![CDATA[ElephantRobotics]]></dc:creator><pubDate>Wed, 22 Jun 2022 02:57:01 GMT</pubDate></item><item><title><![CDATA[Reply to How ROS is used in mechArm 270? on Tue, 21 Jun 2022 09:14:28 GMT]]></title><description><![CDATA[<p dir="auto">What is the auxiliary control of this mechArm?</p>
]]></description><link>https://community.m5stack.com/post/17783</link><guid isPermaLink="true">https://community.m5stack.com/post/17783</guid><dc:creator><![CDATA[kkkkkk]]></dc:creator><pubDate>Tue, 21 Jun 2022 09:14:28 GMT</pubDate></item></channel></rss>