elephantrobotics / Mycobot.csharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a simple c# api about mycobot

dotnet version: 5.0.103

##download

You can download the .dll at Release

#Build on PI
##Environment
The MonoDevelop development tool is recommended
How to install MonoDevelop:https://www.monodevelop.com/download/#fndtn-download-lin
eg:1、Install:
sudo apt install apt-transport-https dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu vs-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-vs.list
sudo apt update
sudo apt-get install monodevelop
2、Test:
Test whether the software is successful, see the introduction here: https://www.monodevelop.com/documentation/creating-a-simple-solution/

##Build&Run
1、Create a C# console application;
2、Copy the code of the cloned file program.cs,then paste it into the program.cs of the new project;
3、Change the serial port id to /dev/ttyAMA0;
pic
4、Change the compilation mode to Release;
pic
5、Add Mycobot.csharp.dll library:ReFerences-->Edit References-->.Net Assembly-->Browse(path for .dll)
pic
6、Run.
Note:Build&&Run,the whole operation process can be seen in the following GIF:
pic
pic
pic

#Build on Windows

###notice:
if you project target frame is .net core,download net core/Mycobot.csharp.dll,if is .net framework,download net framework/Mycobot.csharp.dll)

###how to check target frame

pic

##use

###import

1、import Mycobot.csharp.dll to you Project.
2、add system.io.ports to .csproj( is your project name,this file is in your project directory),like this:
frame: .net core
pic
frame: .net framework
pic

###problem

when use you will have some prolem:
1、probelm: System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies...
solve:update your sdk(if .net core,update to 5.0 and choose,if .net framework update to 4.0 and choose 4.7.2),like this:
pic
2、probelm:System.IO.FileNotFoundException:“Could not load file or assembly 'System.IO.Ports, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
solve:look use-->2

###API /// arm power on public void PowerOn()

/// arm power off public void PowerOff()

/// Send one angle value public void SendOneAngle(int jointNo, int angle, int speed)

/// Send all angles public void SendAngles(int[] angles, int speed)

/// Get all angles public int[] GetAngles()

/// Send one coord public void SendOneCoord(int coord, int value, int speed)

/// Send all coords to arm public void SendCoords(int[] coords, int speed, int mode)

/// Get all coord public int[] GetCoords()

About

License:MIT License


Languages

Language:C# 100.0%