0

大家好,我不是这个角色的专业人士!我正在尝试为办公室创建一个 UI 来控制机器人。在这个 UI 中,我们有一个 rviz 机器人,我在 UI 中加载了这个机器人,如下所示:

RViz Python 教程

我的问题是如何创建滑块来控制像 rviz 这样的机器人关节?

我的 rviz 文件是:

Panels:
  - Class: rviz/Displays
    Help Height: 84
    Name: Displays
    Property Tree Widget:
      Expanded:
        - /MotionPlanning1
      Splitter Ratio: 0.7425600290298462
    Tree Height: 80
  - Class: rviz/Help
    Name: Help
  - Class: rviz/Views
    Expanded:
      - /Current View1
    Name: Views
    Splitter Ratio: 0.5
Preferences:
  PromptSaveOnExit: true
Toolbars:
  toolButtonStyle: 2
Visualization Manager:
  Class: ""
  Displays:
    - Alpha: 0.5
      Cell Size: 1
      Class: rviz/Grid
      Color: 160; 160; 164
      Enabled: true
      Line Style:
        Line Width: 0.029999999329447746
        Value: Lines
      Name: Grid
      Normal Cell Count: 0
      Offset:
        X: 0
        Y: 0
        Z: 0
      Plane: XY
      Plane Cell Count: 10
      Reference Frame: <Fixed Frame>
      Value: true
    - Acceleration_Scaling_Factor: 0.1
      Class: moveit_rviz_plugin/MotionPlanning
      Enabled: true
      Move Group Namespace: ""
      MoveIt_Allow_Approximate_IK: false
      MoveIt_Allow_External_Program: false
      MoveIt_Allow_Replanning: false
      MoveIt_Allow_Sensor_Positioning: false
      MoveIt_Planning_Attempts: 10
      MoveIt_Planning_Time: 5
      MoveIt_Use_Cartesian_Path: false
      MoveIt_Use_Constraint_Aware_IK: true
      MoveIt_Warehouse_Host: 127.0.0.1
      MoveIt_Warehouse_Port: 33829
      MoveIt_Workspace:
        Center:
          X: 0
          Y: 0
          Z: 0
        Size:
          X: 2
          Y: 2
          Z: 2
      Name: MotionPlanning
      Planned Path:
        Color Enabled: false
        Interrupt Display: false
        Links:
          All Links Enabled: true
          Expand Joint Details: false
          Expand Link Details: false
          Expand Tree: false
          Link Tree Style: Links in Alphabetic Order
          Link1:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link10:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link101:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link11:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link111:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link12:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link121:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link2:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link3:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link4:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link5:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link6:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link7:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link8:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link9:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link91:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          base_link:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
        Loop Animation: true
        Robot Alpha: 0.5
        Robot Color: 150; 50; 150
        Show Robot Collision: false
        Show Robot Visual: true
        Show Trail: false
        State Display Time: 0.05 s
        Trail Step Size: 1
        Trajectory Topic: move_group/display_planned_path
      Planning Metrics:
        Payload: 1
        Show Joint Torques: false
        Show Manipulability: false
        Show Manipulability Index: false
        Show Weight Limit: false
        TextHeight: 0.07999999821186066
      Planning Request:
        Colliding Link Color: 255; 0; 0
        Goal State Alpha: 1
        Goal State Color: 250; 128; 0
        Interactive Marker Size: 0
        Joint Violation Color: 255; 0; 255
        Planning Group: arm
        Query Goal State: true
        Query Start State: false
        Show Workspace: false
        Start State Alpha: 1
        Start State Color: 0; 255; 0
      Planning Scene Topic: move_group/monitored_planning_scene
      Robot Description: robot_description
      Scene Geometry:
        Scene Alpha: 1
        Scene Color: 50; 230; 50
        Scene Display Time: 0.20000000298023224
        Show Scene Geometry: true
        Voxel Coloring: Z-Axis
        Voxel Rendering: Occupied Voxels
      Scene Robot:
        Attached Body Color: 150; 50; 150
        Links:
          All Links Enabled: true
          Expand Joint Details: false
          Expand Link Details: false
          Expand Tree: false
          Link Tree Style: Links in Alphabetic Order
          Link1:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link10:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link101:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link11:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link111:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link12:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link121:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link2:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link3:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link4:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link5:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link6:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link7:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link8:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link9:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          Link91:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
          base_link:
            Alpha: 1
            Show Axes: false
            Show Trail: false
            Value: true
        Robot Alpha: 0.5
        Show Robot Collision: false
        Show Robot Visual: true
      Value: true
      Velocity_Scaling_Factor: 0.1
  Enabled: true
  Global Options:
    Background Color: 48; 48; 48
    Default Light: true
    Fixed Frame: base_link
    Frame Rate: 30
  Name: root
  Tools:
    - Class: rviz/Interact
      Hide Inactive Objects: true
    - Class: rviz/MoveCamera
    - Class: rviz/Select
  Value: true
  Views:
    Current:
      Class: rviz/XYOrbit
      Distance: 11.042991638183594
      Enable Stereo Rendering:
        Stereo Eye Separation: 0.05999999865889549
        Stereo Focal Distance: 1
        Swap Stereo Eyes: false
        Value: false
      Field of View: 0.7853981852531433
      Focal Point:
        X: 0.11356700211763382
        Y: 0.10592000186443329
        Z: 2.2351800055275817e-07
      Focal Shape Fixed Size: true
      Focal Shape Size: 0.05000000074505806
      Invert Z Axis: false
      Name: Current View
      Near Clip Distance: 0.009999999776482582
      Pitch: 0.06479708105325699
      Target Frame: base_link
      Yaw: 5.189948558807373
    Saved: ~
Window Geometry:
  Displays:
    collapsed: false
  Height: 713
  Help:
    collapsed: false
  Hide Left Dock: false
  Hide Right Dock: false
  MotionPlanning:
    collapsed: false
  MotionPlanning - Trajectory Slider:
    collapsed: false
  QMainWindow State: 000000ff00000000fd0000000100000000000002a20000026ffc0200000007fb000000100044006900730070006c006100790073000000003d000000e1000000c900fffffffb0000000800480065006c00700000000342000000bb0000006e00fffffffb0000000a0056006900650077007300000003b0000000b0000000a400fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e00670100000374000001890000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000001600000016fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e0067000000003d0000026f0000018800ffffff0000050e0000029600000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730000000000ffffffff0000000000000000
  Views:
    collapsed: false
  Width: 1294
  X: 72
  Y: 27

以及我使用 Robot 运行 rviz 窗口的启动文件:

<launch>

  <!-- specify the planning pipeline -->
  <arg name="pipeline" default="ompl" />

  <!-- By default, we do not start a database (it can be large) -->
  <arg name="db" default="false" />
  <!-- Allow user to specify database location -->
  <arg name="db_path" default="$(find robot620b_moveit_config)/default_warehouse_mongo_db" />

  <!-- By default, we are not in debug mode -->
  <arg name="debug" default="false" />

  <!-- By default, we will load or override the robot_description -->
  <arg name="load_robot_description" default="true"/>

  <!-- Set execution mode for fake execution controllers -->
  <arg name="execution_type" default="interpolate" />

  <!--
  By default, hide joint_state_publisher's GUI

  MoveIt's "demo" mode replaces the real robot driver with the joint_state_publisher.
  The latter one maintains and publishes the current joint configuration of the simulated robot.
  It also provides a GUI to move the simulated robot around "manually".
  This corresponds to moving around the real robot without the use of MoveIt.
  -->
  <arg name="use_gui" default="false" />
  <arg name="use_rviz" default="true" />

  <!-- If needed, broadcast static tf for robot root -->


  <!-- We do not have a robot connected, so publish fake joint states -->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" unless="$(arg use_gui)">
    <rosparam param="source_list">[move_group/fake_controller_joint_states]</rosparam>
  </node>
  <node name="joint_state_publisher" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" if="$(arg use_gui)">
    <rosparam param="source_list">[move_group/fake_controller_joint_states]</rosparam>
  </node>

  <!-- Given the published joint states, publish tf for the robot links -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />

  <!-- Run the main MoveIt executable without trajectory execution (we do not have controllers configured by default) -->
  <include file="$(find robot620b_moveit_config)/launch/move_group.launch">
    <arg name="allow_trajectory_execution" value="true"/>
    <arg name="fake_execution" value="true"/>
    <arg name="execution_type" value="$(arg execution_type)"/>
    <arg name="info" value="true"/>
    <arg name="debug" value="$(arg debug)"/>
    <arg name="pipeline" value="$(arg pipeline)"/>
    <arg name="load_robot_description" value="$(arg load_robot_description)"/>
  </include>

  <!-- Run Rviz and load the default config to see the state of the move_group node -->
  <include file="$(find robot620b_moveit_config)/launch/moveit_rviz.launch" if="$(arg use_rviz)">
    <arg name="rviz_config" value="$(find robot620b_moveit_config)/launch/moveit.rviz"/>
    <arg name="debug" value="$(arg debug)"/>
  </include>

  <!-- If database loading was enabled, start mongodb as well -->
  <include file="$(find robot620b_moveit_config)/launch/default_warehouse_db.launch" if="$(arg db)">
    <arg name="moveit_warehouse_database_path" value="$(arg db_path)"/>
  </include>

</launch>

像这样摇动类似机器人的引擎是我的工作吗?你知道 GitHub 上的项目或示例吗?

我必须使用 moveit 来解决这个问题?我认为不是,因为 moveit 与服务一起工作,这对用户来说太慢了!当我尝试使用 moveit时,我从这个链接获得了帮助

但是移动它是如此缓慢!moveit 适用于按钮而不适用于滑块 我需要使用滑块来控制关节机器人!

4

0 回答 0