Notes on building an environment for simulating the Mycobot 280 M5 on a Mac in a Ros2 environment.
I'm writing this article because there were not many articles.
*I'm a ROS newbie, please comment if you have any pointers or additions 🙇.
Environment.- M3 MacBook Air
- 16GB RAM
Build a Ros2 (humble) environment on Docker
Build an Ubuntu GUI environment with Ros2 installed by referring to this
https://memoteki.net/archives/2955#index_id3
Create a docker container
*In case of M chip, add -arm64
shm-size: shared memory defaut is 64MB, which is not much, so you should set it to at least 2gb
docker run -p 6080:80 --security-opt seccomp=unconfined --shm-size=2G tiryoh/ros2-desktop-vnc:humble-amd64
After a successful boot, go to http://127.0.0.1:6080/へアクセスします
ubuntu should be booted
This is done using the official tutorial
https://moveit.picknik.ai/main/doc/tutorials/getting_started/getting_started.html
Execute the commands in order
*ubuntu terminal
source /opt/ros/humble/setup.bash
Install rosdep (probably already installed)
sudo apt install python3-rosdep
sudo rosdep init
rosdep update
sudo apt update
sudo apt dist-upgrade
Install colcon mixin extension
sudo apt install python3-colcon-common-extensions
sudo apt install python3-colcon-mixin
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default
Install vsctool
sudo apt install python3-vcstool
Create colcon workspace
mkdir -p ~/ws_moveit/src
Get the moveit source code
cd ~/ws_moveit/src
git clone -b humble https://github.com/moveit/moveit2_tutorials
vcs import --recursive < moveit2_tutorials/moveit2_tutorials.repos
Build the colcon workspace
sudo apt remove ros-humble-moveit*
sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro humble -y
Build.
Takes tens of minutes to an hour.
About build arguments
In a docker environment, it is recommended to specify the following arguments to avoid possible memory shortages
- --executor sequential: build one by one
- --parallel-workers 2: Specify the number of simultaneous builds
If possible, increase docker shared memory to speed up the build time
cd ~/ws_moveit
colcon build --mixin release
source.
source ~/ws_moveit/install/setup.bash
echo ‘source ~/ws_moveit/install/setup.bash’ >> ~/.bashrc
About build errors
Various errors were encountered and are left as notes
- pick_ik errors
sudo apt-get remove ros-humble-pick-ik
- ament_cmake error
Run the build command as a privileged user
su
Making the mycobot simulator work with moveit2Create it with reference to this
https://www.youtube.com/watch?v=ZOIKEV_BCBE&t=566s
Get mycobot source for ROS2
Clone it under ws_moveit/src
git clone https://github.com/elephantrobotics/mycobot_ros2.git
Launch the Setup Assistant.
Select Create New MoviIt.
Select mycobot's URDF and press loadFile
mycobot_ros2/mycobot_description/urdf/mhcobot_280_m5/mycobot_280_m5.urdf
Models with a pump or camera at the tip are available, depending on the situation
Self collision settings
Generate collision matrix as default.
Virtual joints settings
Add virtual joints, give them an appropriate name and save them.
Define Planning Groups
Add with Add Group
Select kdl_kinematics_plugin for Solver
Kin. parameters file set to 3
Add Joints.
Add except g_base
Add Links.
Same as above, except g_base added.
Adding poses
Use the sliders to create poses.
Can also be added later.
Setting up the ROS2 controller
push Auto Add
Setting up a moveit controller
push Auto Add
Add Author and email.
Generate & save
Save under src in colcon workspace
build and install
cd ~/ws_moveit
colcon build --mixin release
. install/setup.bash
launch
ros2 launch mycobot_move_it demo.launch.py
Conclusion.
I was able to get it running on the simulator for now.
*The problem is that you can't use usb via Docker on a mac, so you can't run the actual device.
*This article is an English translation of the following article
https://qiita.com/hal_devf/items/dfc0c9094094d09b4960#%E3%81%8A%E3%82%8F%E3%82%8A%E3%81%AB
Comments
Please log in or sign up to comment.