Skip to content

Instantly share code, notes, and snippets.

@rethink-imcmahon
rethink-imcmahon / image_republisher.py
Created January 28, 2016 19:45
Take and Image stream and redirect it to Baxter's Display
#! /usr/bin/python
# Copyright (c) 2016 Rethink Robotics, Inc.
# rospy for the subscriber
import rospy
# ROS Image message
from sensor_msgs.msg import Image
def image_callback(msg, pub):
pub.publish(msg)
<?xml version="1.0" ?>
<launch>
<!-- Load the URDF into the ROS Parameter Server -->
<param name="robot_description" command="cat '$(find your_robot_description)urdf/your.urdf'" />
<node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher" output="screen" args="_use_gui:=true"/>
<!-- Publish a static transform between the world and the base of the robot -->
<node pkg="tf2_ros" type="static_transform_publisher" name="base_to_world" args="0 0 0 0 0 0 1 world base" />
@rethink-imcmahon
rethink-imcmahon / pedestal.yaml
Last active December 16, 2015 20:31
Baxter's base pedestal: rostopic pub /robot/urdf baxter_core_msgs/URDFConfiguration -f pedestal.yaml
time:
secs: 1449783752
nsecs: 232993
link: 'torso'
joint: 'pedestal_fixed'
urdf: '<?xml version="1.0" ?>
<robot name="pedestal">
<link name="pedestal">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
@rethink-imcmahon
rethink-imcmahon / block.yaml
Last active December 10, 2015 15:51
A block to replace baxter's base: rostopic pub /robot/urdf baxter_core_msgs/URDFConfiguration -f block.yaml
time:
secs: 1449703751
nsecs: 232993
link: 'torso'
joint: 'pedestal_fixed'
urdf: '<robot name="pedestal">
<link name="block">
<inertial>
<origin xyz="0.0 0.0 0.0" />
<mass value="40" />
@rethink-imcmahon
rethink-imcmahon / bringup_test_robot.launch
Last active December 2, 2015 20:29
Launch file that I use for testing & tweaking URDFs, Meshes, and Xacros for baxter
<?xml version="1.0" ?>
<launch>
<!-- Load the URDF into the ROS Parameter Server -->
<!-- param name="robot_description" command="cat '$(find baxter_description)/urdf/baxter.urdf'" / -->
<!-- param name="robot_base_description" command="cat '/data/users/imcmahon/dev/mrsp_ws/baxter_urdf.xml'" / -->
<param name="robot_description"
command="$(find xacro)/xacro.py --inorder $(find baxter_description)/urdf/baxter.urdf.xacro" />
<!-- param name="use_sim_time" type="bool" value="true"/-->
<!-- node pkg="rosbag" type="play" name="player" output="screen" args="-i-clock -l /data/users/imcmahon/dev/mrsp_ws/joint_states_increasing_2015-06-12-14-39-06.bag"/ -->
@rethink-imcmahon
rethink-imcmahon / timer_callback_broken.cpp
Created August 31, 2015 21:58
Timer Callback Execution Broken by Patch #654
Breakpoint 1 at 0x403bfb: file /data/users/imcmahon/dev/ros_core_ws/src/ros_tutorials/roscpp_tutorials/timers/timers.cpp, line 59.
(gdb) s
The program is not being run.
(gdb) run
Starting program: /data/users/imcmahon/dev/ros_core_ws/devel/lib/roscpp_tutorials/timers
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1880700 (LWP 23552)]
[New Thread 0x7ffff107f700 (LWP 23553)]
[New Thread 0x7ffff087e700 (LWP 23554)]
@rethink-imcmahon
rethink-imcmahon / timer_callback_functioning.cpp
Created August 31, 2015 21:36
Properly Functioning Timer Callback Execution
PWD=/data/users/imcmahon/dev/ros_core_ws/devel/lib/roscpp_tutorials
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) b 55
Breakpoint 1 at 0x403aee: file /data/users/imcmahon/dev/ros_core_ws/src/ros_tutorials/roscpp_tutorials/timers/timers.cpp, line 55.
(gdb) run
Starting program: /data/users/imcmahon/dev/ros_core_ws/devel/lib/roscpp_tutorials/timers
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1881700 (LWP 6059)]
@rethink-imcmahon
rethink-imcmahon / listener_coredump.cpp
Last active August 29, 2015 14:28
A set of all threads backtraces in attempting to reproduce https://github.com/ros/ros_comm/issues/577
(gdb) thread apply all bt full
Thread 6 (Thread 0x7f34f4aaa700 (LWP 5480)):
#0 0x00007f34f939bda3 in select () at ../sysdeps/unix/syscall-template.S:81
No locals.
#1 0x00007f34f908d89a in XmlRpc::XmlRpcDispatch::work (this=0x156d0e8, timeout=-1)
at /data/users/imcmahon/dev/ros_core_ws/src/ros_comm/utilities/xmlrpcpp/src/XmlRpcDispatch.cpp:107
nEvents = 1
inFd = {fds_bits = {16, 0 <repeats 15 times>}}
outFd = {fds_bits = {0 <repeats 16 times>}}
@rethink-imcmahon
rethink-imcmahon / baxter_joint_cmd.cpp
Last active December 7, 2017 07:11
Baxter Joint Command through ROS Interface example
#include "ros/ros.h"
#include "baxter_core_msgs/JointCommand.h"
int main(int argc, char **argv)
{
ros::init(argc, argv, "baxter_left_arm_joint_pub");
ros::NodeHandle n;
ros::Publisher left_cmd_pub = n.advertise<baxter_core_msgs::JointCommand>("/robot/limb/left/joint_command", 1);
// publish at at least 5 Hz, or else Baxter switches back to Position mode and holds position
ros::Rate loop_rate(100);
baxter_core_msgs::JointCommand cmd;
@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: