Category Archives: Tips error when using cross compiler in debian (e.g. ubuntu)

When I compile a source code for Beaglebone black (arm processor) in my ubuntu 12.04 local computer, I met the following problem.

error while loading shared libraries: cannot open shared object file: No such file or directory

The solution is !!

Copy the below text

” deb unstable main ”

and, go to the package source folder.  /etc/apt/sources.list.d

Then, paste the text in a source list file (e.g, lubuntu-desktop-ppa-precise.list)

Then update or install all necessary files like this.

# apt-get install build-essential
# apt-get install libc6-armhf-cross
# apt-get install libc6-dev-armhf-cross
# apt-get install binutils-arm-linux-gnueabihf
# apt-get install linux-libc-dev-armhf-cross
# apt-get install libstdc++6-armhf-cross
# apt-get install gcc-4.7-arm-linux-gnueabihf
# apt-get install g++-4.7-arm-linux-gnueabihf


I got this solution from a reply of this website.

I really appreciate.

I hope this can help your project.



Maxon EPOS2 Driver C++ Class using USB-CAN Gateway for Multiple Motor Actuation

I am sharing a C++ Class for multiple Maxon motor actuation by EPOS2 via USB-Can gateway.

The source code is written for two motors, but it is possible to modify easily to actuate multiple motors.


If you want to see a simpler version for one motor actuation, see this article. 

I hope this article makes your life easier.


UDP Server C++ Class with a listening thread

I am sharing a code for “UDP Server C++ Class with a listening thread”. In the class “UDPThread”, a thread is running to receive a UDP packet.


Just compile a demo program with this command. Then you will understand.

g++ demo_udp_server.cpp UDPThread.cpp -lpthread -o demo_udp_server

This is the result.

Screenshot from 2015-03-04 15:44:40



I hope this code helps your project.



Minimal c++ class for Maxon EPOS2

Minimal c++ class for Maxon EPOS2

I am sharing the minimal C++ class for Maxon EPOS2. It includes a basic “initialization”, “Move”, “Read position”, “Close device” functions. The program consists of a class called “cmaxonmotor”.  You can download the class and demo program here


You can see a simple demo program here.

#include <stdio.h>
#include <iostream>
#include "cmaxonmotor.h"

using namespace std;

int main(int argc, char *argv[])
    CMaxonMotor motor("USB0",1);
    motor.initializeDevice(); // initialize EPOS2

    long TargetPosition = -200000;
    int CurrentPosition = 0;

    motor.Move(TargetPosition); // move to the target position

    cout << "Press <Enter> to stop and quit..." << endl;
    motor.GetCurrentPosition(CurrentPosition); // get the current position
    cout << "Current Position: " << CurrentPosition << endl;

    motor.closeDevice(); // close EPOS2

    return 0;


You can control one motor just via USB, and also able to control multiple motors via USB-CAN gateway. For this version, see this article.

I hope this helps your project.




Simplest Bidirectional UDP Program in Labview

< Simplest Bidirectional UDP Program in Labview >

Today, I am sharing the simplest bidirectional UDP program made for Labview


I have tried to find a simple birectional UDP program, but it was not easy. Most of programs were incomplete. So I made the thinnest program for only bidirectional UDP communication.

The program is based on the examples provided by NI.

You can download the program at <Download>.  The below is screenshots of the UDP_1 UDP_2program.




I hope this helps your projects.


“Failed to open USBDynamixel” troubleshooting

Recently I met a problem while opening Dynamixel motors with USBDynamixel like the below picture.

My environment is Ubuntu 12.04 and patched with RT-preempted to make my PC real-time.

The solution is very simple, just use “sudo“.  You can see the result in the below picture.
Screenshot from 2014-11-04 12:52:52

Precise Elapsed Time Measurement in C Program

This code is the simplest code to measure a program execution time more precisely.

It is using “struct timeval”.

#include <stdio.h>
#include <sys/time.h>

double getTimeElapsed(struct timeval end, struct timeval start)
    return (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) / 1000000.00;

void main(){
	struct timeval tvalBefore, tvalAfter; 
	gettimeofday(&tvalBefore, NULL);
    // Do something here, this is the simplest program to measure the elapsed time. It is more precise than simple ctimer
	gettimeofday(&tvalAfter, NULL);
	double time_elapsed = getTimeElapsed(tvalAfter, tvalBefore);
	printf("time_elapsed: %lf\n",time_elapsed);

I have referred the below two sites

Good luck ^_^