Open3

Jetson nanoでMoveIt

$~/catkin_ws$ rosrun mycobot_moveit spike.py
Failed to import pyassimp, see https://github.com/ros-planning/moveit/issues/86 for more info

がでた。

https://github.com/assimp/assimp
をいれなおしたらなおった
git clone https://github.com/assimp/assimp.git
cd assimp
cmake CMakeLists.txt 
cmake --build .
make install

mycobotをROS経由でPythonから動かしたかった。参考にしたのは公式チュートリアルです。(Move Group Python Interface — moveit_tutorials Kinetic documentation)

MoveIt!で動かすためのパッケージは下記のものを使わせてもらいます。

https://github.com/nisshan-x/mycobot_moveit

上記のパッケージをいれて、scriptフォルダに下記スクリプトを適当な名前で保存

import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
from math import pi
from std_msgs.msg import String
from moveit_commander.conversions import pose_to_list

moveit_commander.roscpp_initialize(sys.argv)
rospy.init_node('mycobot_commander', anonymous=True) #自分自身のノードの名前なので任意

robot = moveit_commander.RobotCommander()
scene = moveit_commander.PlanningSceneInterface()

group_name = "mycobot_arm" #Rvizのほうで表示される名前と一致させる
move_group = moveit_commander.MoveGroupCommander(group_name)

display_trajectory_publisher = rospy.Publisher('/move_group/display_planned_path', 
moveit_msgs.msg.DisplayTrajectory,
queue_size=20
) #Rvizのほうで表示される名前と一致させる

joint_goal = move_group.get_current_joint_values()
joint_goal[0] = 0
joint_goal[1] = 0
joint_goal[2] = 0
joint_goal[3] = 0
joint_goal[4] = 0
joint_goal[5] = 0

move_group.go(joint_goal, wait=True)
move_group.stop()

Rvizを立ち上げた状態で

$rosrun mycobot_moveit このスクリプト.py 

などとすると動く

PySide2やQtPy5がないといわれた。pyenvを使っているのだけど、ROSがsystemのPythonを参照してしまうのが原因のようだ。しかたがないので2系はsystemのものを指定して、aptでpython-pyqt5などをいれたら動いた。

pyenv global system #実際は3系は指定したかったので pyenv global system 3.x.x とした

エラー

$ roslaunch vis_lecture display.launch model:=simple_body4.urdf
WARNING: Package name "myCobotROS" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
... logging to /home/toyoshi/.ros/log/b4401a48-70be-11eb-85d6-d03745d3df6f/roslaunch-toyoshi-jetson01-16629.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

WARNING: Package name "myCobotROS" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
xacro.py is deprecated; please use xacro instead
started roslaunch server http://toyoshi-jetson01:44923/

SUMMARY
========

PARAMETERS
 * /robot_description: <?xml version="1....
 * /rosdistro: melodic
 * /rosversion: 1.14.10
 * /use_gui: True

NODES
  /
    joint_state_publisher_gui (joint_state_publisher_gui/joint_state_publisher_gui)
    robot_state_publisher (robot_state_publisher/state_publisher)
    rviz (rviz/rviz)

auto-starting new master
process[master]: started with pid [16744]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to b4401a48-70be-11eb-85d6-d03745d3df6f
WARNING: Package name "myCobotROS" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
process[rosout-1]: started with pid [16756]
started core service [/rosout]
process[joint_state_publisher_gui-2]: started with pid [16759]
process[robot_state_publisher-3]: started with pid [16760]
process[rviz-4]: started with pid [16770]
[ WARN] [1613524997.623950029]: The 'state_publisher' executable is deprecated. Please use 'robot_state_publisher' instead
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/joint_state_publisher_gui/joint_state_publisher_gui", line 41, in <module>
    from python_qt_binding.QtWidgets import QApplication
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/__init__.py", line 55, in <module>
    from .binding_helper import loadUi, QT_BINDING, QT_BINDING_MODULES, QT_BINDING_VERSION  # @UnusedImport
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 276, in <module>
    getattr(sys, 'SELECT_QT_BINDING_ORDER', None),
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 120, in _select_qt_binding
    (', '.join(["'%s'" % b for b in binding_order]), '\n'.join(error_msgs)))
ImportError: Could not find Qt binding (looked for: 'pyqt', 'pyside'):
  ImportError for 'pyqt': No module named 'PyQt5'
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 108, in _select_qt_binding
    QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 153, in _load_pyqt
    _named_import('PyQt5.%s' % module_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 133, in _named_import
    module = builtins.__import__(name)
ModuleNotFoundError: No module named 'PyQt5'

  ImportError for 'pyside': No module named 'PySide2'
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 108, in _select_qt_binding
    QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 185, in _load_pyside
    _named_import('PySide2.%s' % module_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 133, in _named_import
    module = builtins.__import__(name)
ModuleNotFoundError: No module named 'PySide2'
ログインするとコメントできます