Friday 17 November 2017

Robot Jacobian in different coordinate for visual servoing





Reference link:
QUT online course: link
vpServo Class of ViSP library: link
vpVelocityTwistMatrix: link

Tuesday 24 January 2017

OpenCV re-projection matrix









Reference:
[1] Learning OpenCV book.
[2] http://www.xuebuyuan.com/1162766.html


VTK volume dimension

These settings specifies the dimension and position of your vtkImageData object.
SetExtent sets the dimensions in each axis. e.g. a dataset of 50 images and width/height of 512/512
myVtkImageData->SetExtent(0,511,0,511,0,49);
SetSpacing sets the size of a voxel (size in each direction x,y,z) in your dataset.
(default)
myVtkImageData->SetSpacing(1,1,1);
SetOrigin sets the position in 3D space of point 0 0 0 (first pixel)
(default)
myVtkImageData->SetOrigin(0,0,0)

The absolute size of a volume is determined by the 'Extent' x 'Spacing' (i.e. number of voxel multiply by size of the voxel). To downsample the volume (increase spacing), we should:

double scale = 2.0;
// Specify the size of the image data
imageData->SetExtent(-100/scale, 100/scale, -100/scale, 100/scale, -50/scale, 50/scale);

imageData->SetSpacing(scale, scale, scale);


//----------------------------------------------------------------------------
void vtkImageData::GetDimensions(int *dOut)
{
  const int* extent = this->Extent;
  dOut[0] = extent[1] - extent[0] + 1;
  dOut[1] = extent[3] - extent[2] + 1;
  dOut[2] = extent[5] - extent[4] + 1;

}

Friday 7 October 2016

Compile & Install OpenCVBlobsLib on Windows

Win7 64bit, Visual Studio 2012, OpenCV 3.0

1. Install pthread-win32 which is required by OpenCVBlobsLib
Instruction: InstallingpthreadsforVisualStudio.pdf

2. Download OpenCVBlobsLibhttp://opencvblobslib.github.io/opencvblobslib/

3. Configure with CMake. Make sure BUILD_SHARED_LIBS is off. CMAKE_CXX_FLAGS_(DEBUG/RELEASE)/CMAKE_C_FLAGS_(DEBUG/RELEASE) has value /MTd (Debug) and /MT (Release) for static link.

4. Configure/Generate/Build

Wednesday 24 February 2016

Add additional slice to model in Solidworks

  1. Open part of model if it's in assembly
  2. Sketch tap -> Sketch button (3D Sketch) -> Select Line (ShortcutL)
  3. Draw three lines (points) and define a plane using the points (NOT two lines)
  4. To define a plane, Feature tab -> Reference Geometry -> Plane
  5. Right click the created plane underFeatureManager Design Tree, select sketch
  6. Select the new sketch, press Convert Entities, then select the plane we want to extrude from original model.
  7. With the sketch selected, press Extruded Boss/Base button.
    • After all slices extruded, we can hide the 3D sketches for better visualization.
  8. Hide other part, only leave extruded part shown. Save the extruded part as separate file with proper name (Note: usecopy and continue in save dialog).
  9. Leave the part edit mode without saving or changing anything in assembly.
  10. Import the saved extruded part in assembly.
  11. Mate three planes (front/top/right) between extruded part and original part.

Export to mesh for colouring

  1. Save as IGS (choose specified coordinate)
  2. Open the IGS file, save as VRML (*.wrl) with VRML97 version which is supported by meshlab
  3. Close IGS file without saving it.

Tuesday 2 February 2016

Setup ROS for multiple machines

1. Pre-request

  • Setup ssh for all computers, usually ssh-client is installed but not ssh-server.
      sudo apt-get install openssh-server
      sudo service ssh status
      sudo ufw allow ssh
    
  • Set host IP for each computer:
    • Get the IP:
        hostname -I
      
    • set IP for ROS_IP
        export ROS_IP=$IP_ADDR$
      

2. Master

There will be a computer run as master machine where roscore will be run.
  • Set ROS_MASTER_URI
      export ROS_MASTER_URI=http://localhost:11311
    
  • Start roscore
  • Start test program
      rosrun rospy_tutorials listener.py
    

3. Slaves (other machines)

  • ssh to remote PC
  • Set ROS_MASTER_URI
      export ROS_MASTER_URI=http://$MASTER_IP_HERE$:11311
    
  • Start test program
      rosrun rospy_tutorials talker.py
    
We should see in the master the message sent by slave is received.
http://nootrix.com/software/ros-networking/

Thursday 30 July 2015

Qt 4 and 5 in same machine (Ubuntu)




"qtchooser -list-versions": get available version of qt.


modify following file 
/usr/lib/x86_64-linux-gnu/qtchooser/5.conf
so that it specify directory of qmake and lib of qt. Example for qt5:
/opt/Qt5.5.0/5.5/gcc_64/bin
/opt/Qt5.5.0/5.5/gcc_64



To choose different qt version: 
"export QT_SELECT=5"

To check current using qt:
"qmake -v" 

"export PKG_CONFIG_LIBDIR=/opt/qt-4.8.7/lib:$PKG_CONFIG_LIBDIR"
"export PATH=/opt/qt-4.8.7/bin:$PATH"
"export PKG_CONFIG_PATH=/opt/qt-4.8.7/lib/pkgconfig/:$PKG_CONFIG_PATH"