Skip to content

Instantly share code, notes, and snippets.

@rethink-imcmahon
rethink-imcmahon / limb_tester.py
Last active August 29, 2015 14:18
Limb Tester for baxter_interface
#! /usr/bin/python
import rospy
import baxter_interface
rospy.init_node("foobar")
l = baxter_interface.Limb('left')
def limb_breaker(tid, l):
while not rospy.is_shutdown():
#!/usr/bin/env python
# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
# This script is meant to how the JTAS handles various numbers of points
# It executes a set of trajectories with 4 waypoints, then 3, then 2, then 1 waypoints. To run it:
# # one baxter.sh sourced terminal
# $ rosrun baxter_tools enable_robot.py -e
# $ rosrun baxter_interface joint_trajectory_action_server.py --mode velocity
@rethink-imcmahon
rethink-imcmahon / random_zero_error.py
Created April 14, 2015 15:35
Useful Time-based-random Zero error
Copyright (c) 2013-2015, Rethink Robotics
All rights reserved.
import time
if round(time.time() % 2):
foo = 10 / 0.0
@rethink-imcmahon
rethink-imcmahon / ros_image_saver.py
Last active April 17, 2024 08:09
ROS Image Subscriber / JPEG Saver
#! /usr/bin/python
# Copyright (c) 2015, Rethink Robotics, Inc.
# Using this CvBridge Tutorial for converting
# ROS images to OpenCV2 images
# http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython
# Using this OpenCV2 tutorial for saving Images:
# http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html
<?xml version="1.0"?>
<robot name="physics">
<link name="base_link">
<visual>
<geometry>
<cylinder length="0.6" radius="0.2"/>
</geometry>
<material name="blue">
<color rgba="0 0 .8 1"/>
</material>
@rethink-imcmahon
rethink-imcmahon / ros.cson
Last active September 28, 2015 08:13
ROS file type extensions - ATOM editor extension "file-types" mapping in config.cson (https://atom.io/packages/file-types)
"file-types": {
'.launch': 'text.xml'
'.world': 'text.xml'
'.xacro': 'text.xml'
'.urdf': 'text.xml'
'.msg': 'source.yaml'
'.srv': 'source.yaml'
'CMakeLists.txt': 'source.cmake'
'.rosinstall': 'source.yaml'
}
@rethink-imcmahon
rethink-imcmahon / joint_torque_delta.py
Last active August 29, 2015 14:24
Baxter's Left and Right Arm Torque readings
#! /usr/bin/python
import rospy
import baxter_interface
import numpy as np
rospy.init_node("torque_tester")
baxter_interface.robot_enable.RobotEnable().enable()
l = baxter_interface.Limb("left")
r = baxter_interface.Limb("right")
print "Moving the left arm to a neutral pose..."
@rethink-imcmahon
rethink-imcmahon / current_ik.py
Created July 20, 2015 19:25
Script for retrieving the IK solution of Baxter's current Joint Pose
#!/usr/bin/env python
# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
@rethink-imcmahon
rethink-imcmahon / baxter_position_controller.cpp
Last active August 29, 2015 14:26
Example of JointGroupEffortController Subclassing
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2013-2015, Rethink Robotics
* Copyright (c) 2013, Open Source Robotics Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@rethink-imcmahon
rethink-imcmahon / baxter_position_controller.h
Created July 31, 2015 15:28
Example of JointGroupEffortController Subclassing
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2013-2015, Rethink Robotics
* Copyright (c) 2013, Open Source Robotics Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met: