Skip to content

Instantly share code, notes, and snippets.

View felixvd's full-sized avatar

Felix von Drigalski felixvd

  • Mujin Inc.
  • Tokyo, Japan
View GitHub Profile
----------------------------------------------------------------------------------------------------------------------
Profile: default
Extending: [explicit] /opt/ros/melodic
Workspace: /root/linked_ws_moveit
----------------------------------------------------------------------------------------------------------------------
Build Space: [exists] /root/linked_ws_moveit/build
Devel Space: [exists] /root/linked_ws_moveit/devel
Install Space: [unused] /root/linked_ws_moveit/install
Log Space: [missing] /root/linked_ws_moveit/logs
Source Space: [exists] /root/linked_ws_moveit/src
@felixvd
felixvd / cmodel_urcap.py
Created August 20, 2020 02:54
Robotiq gripper control node for UR-mounted grippers with URCap installed on the pendant
"""Module to control Robotiq's gripper 2F-85."""
# BASED ON: https://dof.robotiq.com/discussion/1962/programming-options-ur16e-2f-85#latest
# ROS/Python2 port by felixvd
import socket
import threading
import time
from enum import Enum
# Added for ROS
@felixvd
felixvd / robotiq_control.py
Created August 6, 2020 12:09
Debugging notes for Modbus RTU/TCP for Robotiq gripper
#!/usr/bin/env python
import os
import sys
import socket
from math import ceil
import time
import threading
from pymodbus.client.sync import ModbusTcpClient
from pymodbus.register_read_message import ReadInputRegistersResponse
@felixvd
felixvd / gist:87ce31d7f1053410186d70b5a960a213
Created July 26, 2020 18:13
Valgrind output 2020-7-27
[ INFO] [1595786409.984394846]: Moving to bottom of box with cylinder tip
==2459== Invalid read of size 16
==2459== at 0x3365BB: _mm_loadu_pd (emmintrin.h:131)
==2459== by 0x3365BB: double __vector(2) Eigen::internal::ploadu<double __vector(2)>(Eigen::internal::unpacket_traits<double __vector(2)>::type const*) (PacketMath.h:336)
==2459== by 0x378616: ploadt<__vector(2) double, 0> (GenericPacketMath.h:465)
==2459== by 0x378616: double __vector(2) Eigen::internal::mapbase_evaluator<Eigen::Block<Eigen::Matrix<double, 4, 4, 0, 4, 4> const, 3, 3, false>, Eigen::Matrix<double, 3, 3, 0, 3, 3> >::packet<0, double __vector(2)>(long, long) const (CoreEvaluators.h:860)
==2459== by 0x3B7D21: Eigen::internal::etor_product_packet_impl<0, 1, Eigen::internal::evaluator<Eigen::Block<Eigen::Matrix<double, 4, 4, 0, 4, 4> const, 3, 3, false> >, Eigen::internal::evaluator<Eigen::Block<Eigen::Matrix<double, 4, 4, 0, 4, 4> const, 3, 3, false> >, double __vector(2), 0>::run(long, long, Eigen::internal::evaluator<Eigen
@felixvd
felixvd / pointer_reference_example.cpp
Last active June 19, 2020 10:32
Pointer and reference example (C++)
void add_one_to_int(int& number)
{
// This increases the value of the parameter.
// The value will persist outside of the function, because the reference is passed,
// so the memory address is used.
number++;
}
void add_one_to_int_using_pointer(int* number_pointer)
{
@felixvd
felixvd / gist:993620d534898b1f159014451c97a7a7
Created May 24, 2020 17:31
Debugging code & Error output
Lines 1714-1735:
if (object.operation == moveit_msgs::CollisionObject::ADD && world_->hasObject(object.id))
world_->removeObject(object.id);
ROS_WARN_STREAM("Received collision object with id: " << object.id);
ROS_WARN_STREAM("header.frame_id: " << object.header.frame_id);
const Eigen::Isometry3d& world_to_object_header_transform = getTransforms().getTransform(object.header.frame_id);
ROS_WARN_STREAM("world_to_object_header_transform: ");
root@f092958e2d44:~/ws_moveit/src/moveit_tutorials# ./build_locally.sh
Documenting a catkin package
Documenting moveit_tutorials located here: /root/ws_moveit/src/moveit_tutorials
{'sphinx': {'builder': 'sphinx', 'sphinx_root_dir': '.'}}
Catkin package, no need to generate python paths
Sphinx python path is: /root/ws_moveit/install/lib/python2.7/dist-packages:/opt/ros/melodic/lib/python2.7/dist-packages
sphinx-building moveit_tutorials [sphinx-build -a -E -b html . /root/ws_moveit/src/moveit_tutorials/build/html/.]
cwd is /root/ws_moveit/src/moveit_tutorials
stdout:
Running Sphinx v1.6.7
@felixvd
felixvd / connect_to_robots.launch
Created January 25, 2020 14:21
Extract from the launch file starting up ur_robot_driver nodes
<!-- Robot parameters that are separate for a_bot and b_bot -->
<arg name="robot_ip_a" default="192.168.0.41"/>
<arg name="robot_ip_b" default="192.168.0.42"/>
<arg name="reverse_port_a" default="50001" />
<arg name="script_sender_port_a" default="50002" />
<arg name="reverse_port_b" default="50003" doc="Port that will be opened by the driver to allow direct communication between the driver and the robot controller."/>
<arg name="script_sender_port_b" default="50004" doc="The driver will offer an interface to receive the program's URScript on this port. If the robot cannot connect to this port, `External Control` will stop immediately."/>
<arg name="use_tool_communication_a" default="false"/>
<arg name="use_tool_communication_b" default="false" doc="On e-Series robots tool communication can be enabled with this argument"/>
<arg name="tool_device_name_a" default="/tmp/ttyUR_a"/>
@felixvd
felixvd / subframes_tutorial.cpp
Last active January 24, 2020 20:30
Sandbox for testing subframes and attached objects
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2019, Felix von Drigalski
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
@felixvd
felixvd / wait_for_program.h
Last active November 14, 2019 17:38
A header file to wait for UR robots to complete a UR script program sent via ROS.
#pragma once
// This header file can be copied into the folder ur_modern_driver/include/ur_modern_driver
// of the ur_modern_driver ROS package and included in your program for convenience.
// It waits for a program to be completed on the UR controller.
// Note that this is useful mostly for custom scripts. A move command sent through
// ur_modern_driver/MoveIt will stay active on the UR controller, and the wait will time out.
#include "ros/ros.h"
#include "ur_msgs/RobotModeDataMsg.h"