Open djy89 opened 3 days ago
One way to attach an end effector is to modify the URDF directly (or more specifically, create a new URDF that uses your existing one). We have documented how to do this here: https://compas.dev/compas_fab/latest/examples/03_backends_ros/07_ros_create_urdf_ur5_with_measurement_tool.html.
This approach is quite involved, but it's the official ROS way to do this. Considering how complicated this is, we have created this alternative approach that you've probably been using. I haven't tested it on compas_view
though, so, it might not be showing up atm, but we are working on some big changes that will fix it in the next few months.
Yes, Thank you very much.
There is no example illustrating how to use robot_object.attach_tool() and display it on the Viewer.screen below, nor how to change the joint and have the end follow the changes. The example below only displays the robot, but not the tool attached to the robotic arm. Could the official provide a corresponding example that displays the robotic arm and end claw on the Viewer, without necessarily using ROS or Rhino for display.
Can you provide an example related to attach_tool and demonstrate how to display and update joint changes in the Viewer, ensuring that the tool at the end follows the changes, without utilizing ROS or other CAD environments。Thankyou very much。
programe:Only Robot is displayed below。
from compas_robots.viewer.scene.robotmodelobject import RobotModelObject from compas_viewer.components import Slider from compas_viewer import Viewer
from compas.datastructures import Mesh from compas.geometry import Frame from compas_robots import RobotModel from compas_robots.model.tool import ToolModel from compas_robots.resources import LocalPackageMeshLoader import compas_fab viewer = Viewer() viewer.renderer.rendermode="lighted" urdf_filename ='./ur5.urdf' model = RobotModel.from_urdf_file(urdf_filename) model.load_geometry(LocalPackageMeshLoader(compas_fab.get("universal_robot"), "ur_description"), precision=5) configuration = model.zero_configuration() robot_object: RobotModelObject = viewer.scene.add(model, show_lines=False, configuration=configuration) # type: ignore viewer.ui.sidedock.show = True ##############attach_tool_model################## mesh = Mesh.from_stl("./vacuum_gripper.stl") frame_t = Frame([0, 0, 0.07], [1, 0, 0], [0, 1, 0]) tool_model = ToolModel(mesh, frame_t, connected_to="wrist_3_link") robot_object.attach_tool_model(tool_model)###TODO not work!!!! viewer.renderer.update() ###########################
robot = RobotClass(model, scene_object=None, semantics=semantics, client=None) robot.attach_tool(tool)
######################### ##############attach_tool_model##################
def make_rotate_function(index): def rotate(slider: Slider, value: int): config = robot_object.configuration config.joint_values[index] = value / 360 2 3.14159 robot_object.update_joints(config) return rotate
for i, joint in enumerate(robot_object.configuration.joint_names): rotate_function = make_rotate_function(i) viewer.ui.sidedock.add(Slider(title=joint, starting_val=0, min_val=-180, max_val=180, step=1, action=rotate_function)) robot_object.update_joints(robot_object.configuration) viewer.show()
Do you know how to attach an end tool to the end of a robotic arm and use a Viewer instead of using GUI such as ROS Rivz or Rhino? I have tried but it cannot be attached and displayed in Compas_View。
Are there any relevant usage examples of additional end tools for the compas_View real robotic arm