File size: 13,786 Bytes
9b148bc
1
[{"prompt": "compute the forward kinematics", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> target_joint_angles = [0.2]*r.dof\n> tcp_pose = r.compute_forward_kinematics(joint_angles)\n> "}, {"prompt": "disable the collision detection", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.disable_collision_detection()\n> "}, {"prompt": "enable the reflexes of the robot", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.enable_reflex()\n> "}, {"prompt": "plan a move joint", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> planned_motion_ids = r.plan_move_joint([0]*r.dof)  # Replace with your planned motion IDs\n> r.executor([planned_motion_ids])\n> "}, {"prompt": "get the current cartesian pose", "completion": "\nfrom neurapy.robot import Robot\nr = Robot()\ncartesian_pose = r.get_current_cartesian_pose()\n"}, {"prompt": "get the current joint angles with the corresponding timestamp", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> joint_angles, timestamp = r.get_current_joint_angles_with_timestamp()\n> "}, {"prompt": "get the current joint velocities", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> joint_velocites = r.get_current_joint_velocities()\n> "}, {"prompt": "get the current load side encoder values with the corresponding timestamp", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> encoder_ticks, timestamp = r.get_current_load_side_encoder_values_with_timestamp()\n> "}, {"prompt": "get the center of gravity of the current tool", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> tool_cog = r.get_current_tool_cogs()\n> "}, {"prompt": "get the properties of the current tool", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> tool_properties = r.get_current_tool_properties()\n> "}, {"prompt": "get robot diagnostics", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> print(r.get_diagnostics())\n> "}, {"prompt": "function to retrieve docs for a function", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> description = r.get_doc(\"move_joint\")\n> print(description)\n> "}, {"prompt": "get the gravity vector", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> vector = r.get_gravity_vector()\n> print(vector)\n> "}, {"prompt": "get the override value", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> override_value = r.get_override()\n> print(f\"Current override value: {override_value}\")\n> "}, {"prompt": "get the reference frame", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> frame = r.get_reference_frame(\"tool_frame\")\n> print(frame)\n> "}, {"prompt": "get the current tcp pose", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> tcp_pose = r.get_tcp_pose()\n> print(tcp_pose)\n> "}, {"prompt": "get the tools digital input", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n> io_get = r.get_tool_digital_input(1)\n> print(io_get)\n> "}, {"prompt": "get the list of available tools", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> tools = r.get_tools()\n> print(tools)\n> "}, {"prompt": "grasp the object", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.grasp()\n> "}, {"prompt": "get the io values on the robot", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n> io_get = r.io(\"get\", io_name = \"DO_1\")\n> io_set = r.io(\"set\", io_name = \"DO_2\", target_value = True)\n> print(io_get,io_set)\n> "}, {"prompt": "check if the reflex is enabled", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> if r.is_reflex_enabled():\n>     print(\"Reflex collision avoidance is enabled.\")\n> else:\n>     print(\"Reflex collision avoidance is not enabled.\")\n> "}, {"prompt": "check if robot is in semi automatic mode", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> if r.is_robot_in_semi_automatic_mode():\n>     print(\"Robot is in semi automatic mode\")\n> else:\n>     print(\"Robot is not in semi automatic mode\")\n> "}, {"prompt": "jog the robot", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n\n> '''\n> jog_velocity - velocity ranging from [-1,1] for all joints. Signifies percentage of total speed used (1 = 100%)\n> jog_type - can be either cartesian or joint jogging\n> turn_on_jog sets the parameters of external jogging, jogging velocity, jogging type and sets the mode for jogging to external mode.\n> '''\n> r.turn_on_jog(jog_velocity=[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], jog_type='Joint')\n> r.jog(set_jogging_external_flag=1)\n> i = 0\n> '''\n> Requires minimum number of cycles in the loop for performing jogging.\n> Depends upon jogging velocity, override.\n> '''\n> while i < 500:\n>     #command to set flag to start jogging in external mode. This command has to be used each time external jog command has to be sent\n>     r.jog(set_jogging_external_flag=1)\n>     i += 1\n\n> #Command to switch back to internal jogging mode (GUI)\n> r.turn_off_jog()\n> "}, {"prompt": "perform a circular move", "completion": "\n> from neurapy.robot import Robot\n\n> r = Robot()\n> circular_property = {\n>     \"speed\": 0.25,\n>     \"acceleration\": 0.1,\n>     \"target_pose\": [\n>         [\n>             0.3744609827431085,\n>             -0.3391784988266481,\n>             0.23276604279256016,\n>             3.14119553565979,\n>             -0.00017731254047248513,\n>             -0.48800110816955566\n>         ],\n>         [\n>             0.37116786741831503,\n>             -0.19686307684994242,\n>             0.23300456855796453,\n>             3.141423225402832,\n>             -0.00020668463548645377,\n>             -0.48725831508636475\n>         ],\n>         [\n>             0.5190337951593321,\n>             -0.1969996948428492,\n>             0.23267853691809767,\n>             3.1414194107055664,\n>             -0.00017726201622281224,\n>             -0.48750609159469604\n>         ]\n>     ],\n>     \"current_joint_angles\": r.robot_status(\"jointAngles\")\n> }\n> r.move_circular(**circular_property)\n> r.stop() # if there are multiple motions than,this needs to be called only once at the end of the script\n> "}, {"prompt": "perform a linear move", "completion": "\n> from neurapy.robot import Robot\n\n> r = Robot()\n> linear_property = {\n>     \"speed\": 0.25,\n>     \"acceleration\": 0.1,\n>     \"blend_radius\": 0.005,\n>     \"target_pose\": [\n>         [\n>             0.3287228886,\n>             -0.1903355329,\n>             0.4220780352,\n>             0.08535207028439847,\n>             -2.797181496822229,\n>             2.4713321627410485\n>         ],\n>         [\n>             0.2093363791501374,\n>             -0.31711250784165884,\n>             0.422149168855134,\n>             -3.0565555095672607,\n>             -0.3447442352771759,\n>             -1.1323236227035522\n>         ],\n>         [\n>             0.2090521916195534,\n>             -0.5246753336643587,\n>             0.4218773613553828,\n>             -3.0569007396698,\n>             -0.3448921740055084,\n>             -1.1323626041412354\n>         ],\n>         [\n>             0.3287228886,\n>             -0.1903355329,\n>             0.4220780352,\n>             0.08535207028439847,\n>             -2.797181496822229,\n>             2.4713321627410485\n>         ]\n>     ],\n>     \"current_joint_angles\": r.robot_status(\"jointAngles\")\n> }\n> r.move_linear(**linear_property)\n> r.stop() # if there are multiple motions than,this needs to be called only once at the end of the script\n> "}, {"prompt": "send an error message", "completion": "\nfrom neurapy.robot import Robot\nr = Robot()\nif r.notify_error(\"Something went wrong!\"):\n    print(\"Error message sent successfully.\")\nelse:\n    print(\"Failed to send error message.\")\n"}, {"prompt": "pause the robot", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.pause()\n> "}, {"prompt": "plan a composite move", "completion": "\n> from neurapy.robot import Robot\n\n> r = Robot()\n> composite_motion_property = {\n>     \"speed\": 0.432,\n>     \"acceleration\": 0.2,\n>     \"current_joint_angles\": r.robot_status('jointAngles'),\n>     \"commands\": [\n>         {\n>             \"linear\": {\n>                 \"blend_radius\": 0.005,\n>                 \"targets\": [\n>                     [\n>                         -0.000259845199876027,\n>                         -0.5211437049195536,\n>                         0.4429382717719519,\n>                         3.14123272895813,\n>                         -0.0007908568368293345,\n>                         -1.570908784866333\n>                     ],\n>                     [\n>                         -0.16633498440272945,\n>                         -0.5201452059140722,\n>                         0.4427486025872017,\n>                         3.140937089920044,\n>                         -0.0005319403717294335,\n>                         -1.571555495262146\n>                     ]\n>                 ]\n>             }\n>         },\n>         {\n>             \"circular\": {\n>                 \"targets\": [\n>                     [\n>                         -0.16633498440272945,\n>                         -0.5201452059140722,\n>                         0.4427486025872017,\n>                         3.140937089920044,\n>                         -0.0005319403717294335,\n>                         -1.571555495262146\n>                     ],\n>                     [\n>                         -0.16540090985202305,\n>                         -0.3983552679378624,\n>                         0.44267608017426174,\n>                         3.1407113075256348,\n>                         -0.00036628879024647176,\n>                         -1.5714884996414185\n>                     ],\n>                     [\n>                         -0.33446498807559716,\n>                         -0.3989652352814891,\n>                         0.4421152856242009,\n>                         3.1402060985565186,\n>                         0.00030071483342908323,\n>                         -1.572899580001831\n>                     ]\n>                 ]\n>             }\n>         }\n>     ],\n>     \"store_id\":234,\n>     \"current_joint_angles\": r.robot_status(\"jointAngles\")\n> }\n> plan_id= r.plan_move_composite(**composite_motion_property)\n> execute = r.executor([plan_id])\n> "}, {"prompt": "power on", "completion": "\n    from time import sleep\n    from neurapy.robot import Robot\n\n    r = Robot()\n    r.power('on')\n    sleep(2)\n    r.power('off')\n    "}, {"prompt": "get the program status", "completion": "\n> from neurapy.robot import Robot\n\n> r = Robot()\n> print(r.program_status())\n> "}, {"prompt": "release the object", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.release()\n> "}, {"prompt": "reset errors", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n> r.reset_error()\n> "}, {"prompt": "calculate rpy from quaternion representation", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> rpy = r.quaternion_to_rpy(0.85,0,0.52,0)\n> "}, {"prompt": "set the encoder offsets", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.set_encoder_offsets([#encoder offsets from the provided robot manual/data sheet])\n> "}, {"prompt": "send a message to opcua", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> message = \"Hello, OPC UA Server!\"\n> register_index = 1  # Replace with the index of the target OPC UA register\n> if r.set_opcua_msg(message, register_index):\n>     print(\"Message sent and stored in OPC UA register successfully.\")\n> else:\n>     print(\"Failed to send the message or store it in the OPC UA register.\")\n> "}, {"prompt": "set the tool", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.set_tool(tool_name=\"name given during tool creation in GUI\")\n> "}, {"prompt": "switch to automatic mode", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> if r.switch_to_automatic_mode():\n>     print(\"Robot switched to Automatic mode.\")\n> else:\n>     print(\"Failed to switch to Automatic mode.\")\n> "}, {"prompt": "switch to simulation", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.switch_to_simulation()\n> "}, {"prompt": "turn jogging on", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n> r.turn_on_jog(jog_velocity=[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], jog_type='Joint')\n> r.jog(set_jogging_external_flag=1)\n> i = 0\n> while i < 500:\n>     r.jog(set_jogging_external_flag=1)\n>     i += 1\n> r.turn_off_jog()\n> "}, {"prompt": "unpause", "completion": "\n> from neurapy.robot import Robot\n> r = Robot()\n> r.unpause()\n> "}, {"prompt": "wait for a digital input", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n> io_wait = r.wait_for_digital_input(1,True) #waits till digital input 1 is True\n> print(io_wait)\n> "}, {"prompt": "wait for analog input", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n> io_wait = r.wait_for_tool_analog_input(1,2.3v) #waits till tool analog input 1 is 2.3v\n> print(io_wait)\n> "}, {"prompt": "delayed wait for tool digital input", "completion": "\n> import time\n> from neurapy.robot import Robot\n> r = Robot()\n> io_wait = r.wait_for_tool_digital_input_timer_on_delay(1,10) #waits for 10sec and returns after tool digital input 1 reaches high\n> print(io_wait)\n> "}]