This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from html.parser import HTMLParser | |
import re | |
class MyHTMLParser(HTMLParser): | |
def __init__(self): | |
HTMLParser.__init__(self) | |
self.mode= None | |
self.serialized= [] | |
def handle_starttag(self, tag, attrs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#Printing current position without enabling torque. | |
from dxl_util import * | |
from _config import * | |
import time | |
#Setup the device | |
DXL_ID= [1,2] #IDs of the Dynamixels. | |
BAUDRATE= 57600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#Change ID. | |
from dxl_util import * | |
DXL_ID= 1 #Current ID | |
NEW_ID= 2 #New ID | |
BAUDRATE= 57600 | |
#DXL_TYPE= 'XM430-W350' #Finger robot | |
DXL_TYPE= 'XH430-V350' #Dynamixel gripper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Changing exposure worked with the ELP camera on Windows. | |
#include "stdafx.h" | |
#include <opencv2/opencv.hpp> | |
bool ParamChanged(false); | |
void OnTrack(int,void*) | |
{ | |
ParamChanged= true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from core_tool import * | |
import cv2 | |
import numpy as np | |
def Run(ct,*arg): | |
cap = cv2.VideoCapture('http://aypi11:8081/?action=stream&dummy=file.mjpg') | |
#q0= np.array(ct.robot.Q()) | |
t0= rospy.Time.now() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from core_tool import * | |
def Help(): | |
return '''First script. | |
Usage: a.ros''' | |
def Run(ct,*args): | |
print len(args) | |
print args[0] | |
q= list(ct.robot.Q()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Following codes are an example of processing marker tracker topic from FingerVision. | |
I just copied them from my system, which might be incomplete, but you could find the idea of the calculation. | |
The main function to process the marker tracker topic is BlobMoves. | |
(see `def BlobMoves(t,l,msg,side)`) | |
t: Interface of core tools (ROS connection, robot controller, etc.); you can replace t by adequate functions. | |
l: A container object. The simplest implementation is like: | |
class Container(): pass | |
l= Container() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
################################################################################ | |
# Copyright (c) 2016, ROBOTIS CO., LTD. | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#NOTE: Remove and Upgrade scikit-learn (v.1.8 is necessary) | |
# sudo apt-get remove python-sklearn python-sklearn-lib | |
# sudo pip install -U scikit-learn | |
import random, math | |
import numpy as np | |
import matplotlib.pyplot as plot | |
from mpl_toolkits.mplot3d import Axes3D | |
from sklearn.gaussian_process import GaussianProcessRegressor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#Download CMA-ES for Python from https://www.lri.fr/~hansen/cmaesintro.html | |
#and put cma.py in the same directory | |
import numpy as np | |
import matplotlib.pyplot as plot | |
from fk import FK | |
import cma | |
plot.ioff() #cma set matplotlib.pyplot.ion() | |
#Error function of inverse kinematics |
NewerOlder