search
HomeBackend DevelopmentC#.Net TutorialShare GTS-800 secondary development process steps
Share GTS-800 secondary development process stepsJun 23, 2017 pm 04:13 PM
Secondary developmentBasicSummarizeprocess

1. Open the controller GT_Open
2. Start the servo enable GT_ClrSts
3. Clear the axis planning position GT_SetPrfPos
4. Axis motion mode GT_PrfTrap
5. Axis target position GT_SetPos
6. Axis rotation speed GT_SetVel
7. Start axis GT_Update
8. Close enable GT_AxisOff
9. Close the controller GT_Close
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using gts;


namespace GTS
{
    class Program
    {
        static void command(string sz, short nR)
        {
            Console.WriteLine(sz + " = " + nR);
        }

        static void Main(string[] args)
        {
            short mAxis = 2;
            short nR = mc.GT_Open(0, 1);
            if (nR != 0)
            {
                command("GT_Open", nR);
                Console.WriteLine("Open error");
                return;
            }
            command("GT_Open", nR);
            // 清除各轴的报警和限位
            command("GT_ClrSts", mc.GT_ClrSts(mAxis, 1));
            // 伺服使能
            command("GT_AxisOn", mc.GT_AxisOn(mAxis));
            // 位置清零
            command("GT_ZeroPos", mc.GT_ZeroPos(mAxis, 1));
            // 轴规划位置清零
            command("GT_SetPrfPos", mc.GT_SetPrfPos(mAxis, 0));
            // 设置指定轴为点位运动模式。
            command("GT_PrfTrap", mc.GT_PrfTrap(mAxis));
            // 设置点位运动参数
            mc.TTrapPrm trap = new mc.TTrapPrm();
            trap.acc = 0.25;
            trap.dec = 0.125;
            trap.smoothTime = 25;
            command("GT_SetTrapPrm", mc.GT_SetTrapPrm(mAxis, ref trap));
            // 设置轴的目标位置
            command("GT_SetPos", mc.GT_SetPos(mAxis, 50000));
            // 设置轴的目标速度
            command("GT_SetVel", mc.GT_SetVel(mAxis, 25));
            // 启动轴运动
            command("GT_Update", mc.GT_Update(1 << mAxis - 1));

            mc.GT_Close();
            Console.ReadKey();
        }
    }
}
C++源码:
#include "stdafx.h"
#include "windows.h"
#include "conio.h"
#include "gts.h"

#define AXIS		1

// 该函数检测某条GT指令的执行结果,command为指令名称,error为指令执行返回值
void commandhandler(char *command, short error)
{
	// 如果指令执行返回值为非0,说明指令执行错误,向屏幕输出错误结果
	if(error)
	{
		printf("%s = %d\n", command, error);
	}
}
int main(int argc, char* argv[])
{
	short sRtn;
	TTrapPrm trap;
	long sts;
	double prfPos;

	// 打开运动控制器
	sRtn = GT_Open();
	// 指令返回值检测,请查阅例2-1
	commandhandler("GT_Open", sRtn);
	// 配置运动控制器
	// 注意:配置文件取消了各轴的报警和限位
	sRtn = GT_LoadConfig("test.cfg");
	commandhandler("GT_LoadConfig ", sRtn);
	// 清除各轴的报警和限位
	sRtn = GT_ClrSts(1, 8);
	commandhandler("GT_ClrSts", sRtn);
	// 伺服使能
	sRtn = GT_AxisOn(AXIS);
	commandhandler("GT_AxisOn", sRtn);

	// 位置清零
	sRtn = GT_ZeroPos(AXIS);
	commandhandler("GT_ZeroPos", sRtn);
	// AXIS轴规划位置清零
	sRtn = GT_SetPrfPos(AXIS, 0);
	commandhandler("GT_SetPrfPos", sRtn);
	// 将AXIS轴设为点位模式
	sRtn = GT_PrfTrap(AXIS);
	commandhandler("GT_PrfTrap", sRtn);
	// 读取点位运动参数
	sRtn = GT_GetTrapPrm(AXIS, &trap);
	commandhandler("GT_GetTrapPrm", sRtn);
	trap.acc = 0.25;
	trap.dec = 0.125;
	trap.smoothTime = 25;
	// 设置点位运动参数
	sRtn = GT_SetTrapPrm(AXIS, &trap);
	commandhandler("GT_SetTrapPrm", sRtn);
	// 设置AXIS轴的目标位置
	sRtn = GT_SetPos(AXIS, 50000L);
	commandhandler("GT_SetPos", sRtn);
	// 设置AXIS轴的目标速度
	sRtn = GT_SetVel(AXIS, 50);
	commandhandler("GT_SetVel", sRtn);
	// 启动AXIS轴的运动
	sRtn = GT_Update(1<<(AXIS-1));
	commandhandler("GT_Update", sRtn);

	do
	{
		// 读取AXIS轴的状态
		sRtn = GT_GetSts(AXIS, &sts);
		// 读取AXIS轴的规划位置
		sRtn = GT_GetPrfPos(AXIS, &prfPos);
		printf("sts=0x%-10lxprfPos=%-10.1lf\r", sts, prfPos);
	}while(sts&0x400);	// 等待AXIS轴规划停止

	// 伺服关闭
	sRtn = GT_AxisOff(AXIS);
	printf("\nGT_AxisOff()=%d\n", sRtn);
	getch();
	return 0;

}

The above is the detailed content of Share GTS-800 secondary development process steps. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
简单易懂的Java海康SDK二次开发指南简单易懂的Java海康SDK二次开发指南Sep 06, 2023 pm 02:01 PM

简单易懂的Java海康SDK二次开发指南引言:随着摄像监控技术的发展,海康威视已成为全球领先的安防解决方案供应商之一,其提供的SDK(软件开发工具包)为开发人员提供了丰富的功能和接口,用于二次开发和定制化开发。本文将介绍如何使用Java语言进行海康SDK的二次开发,并提供一些代码示例,以帮助读者更好地理解和应用。一、环境准备首先,在进行海康SDK二次开发之前

百度智能云千帆大模型平台再升级:5款大模型、55个工具组件上新!百度智能云千帆大模型平台再升级:5款大模型、55个工具组件上新!Mar 22, 2024 am 08:10 AM

服务8万企业用户,累计帮助用户精调1.3万个大模型,帮助用户开发出16万个大模型应用,自2023年12月以来百度智能云千帆大模型平台API日调用量环比增长97%...从一年前国内大模型平台的“开路先锋”到如今的大模型“超级工厂”,百度智能云千帆大模型平台在国内大模型市场牢牢占据着领先身位,但奔跑的脚步却并未停歇。3月21日,百度智能云在北京首钢园召开千帆产品发布会,百度智能云在大会期间宣布:1、携手北京市石景山区,共建全国首个百度智能云千帆大模型产业创新基地,助推区域产业腾飞;2、满足企业“效价

TensorFlow深度学习框架模型推理Pipeline进行人像抠图推理TensorFlow深度学习框架模型推理Pipeline进行人像抠图推理Mar 26, 2024 pm 01:00 PM

概述为了使ModelScope的用户能够快速、方便的使用平台提供的各类模型,提供了一套功能完备的Pythonlibrary,其中包含了ModelScope官方模型的实现,以及使用这些模型进行推理,finetune等任务所需的数据预处理,后处理,效果评估等功能相关的代码,同时也提供了简单易用的API,以及丰富的使用样例。通过调用library,用户可以只写短短的几行代码,就可以完成模型的推理、训练和评估等任务,也可以在此基础上快速进行二次开发,实现自己的创新想法。目前library提供的算法模型,

提升Java海康SDK二次开发技能的关键要素提升Java海康SDK二次开发技能的关键要素Sep 06, 2023 pm 01:42 PM

提升Java海康SDK二次开发技能的关键要素摘要:随着物联网的快速发展,视频监控系统在安防领域的应用越来越广泛。而作为视频监控系统中最重要的组成部分,海康威视(Hikvision)的SDK在二次开发过程中扮演着重要的角色。本文将介绍海康SDK的基本使用方法,并提供一些关键要素和代码示例,以帮助读者提升Java海康SDK二次开发技能。一、了解海康SDK的基本概

wordpress二次开发是什么意思wordpress二次开发是什么意思Apr 16, 2024 am 12:09 AM

WordPress 二次开发允许开发人员定制和扩展 WordPress 功能,创建满足特定需求的附加功能、主题和插件。通过二次开发,开发人员可以定制 WordPress,扩展其核心功能,增加其灵活性,并随着网站和业务的发展轻松扩展其可扩展性。

MyBatis逆向工程的优势与限制MyBatis逆向工程的优势与限制Feb 22, 2024 pm 07:27 PM

MyBatis是一种流行的持久化框架,它提供了逆向工程的功能,这使得开发人员可以根据数据库中的表结构自动生成实体类、Mapper接口和XML映射文件。逆向工程是MyBatis的一个重要特性,它可以大大减少开发人员的工作量,并提高代码的可维护性。然而,逆向工程也有一些限制,本文将介绍MyBatis逆向工程的优势和限制,并通过具体的代码示例加以说明。首先,让我们

WordPress是什么?详解这个流行的网站建设工具WordPress是什么?详解这个流行的网站建设工具Mar 04, 2024 pm 12:09 PM

WordPress是什么?详解这个流行的网站建设工具WordPress是一个开放源码的内容管理系统(CMS),最初是为博客而设计,但随着发展逐渐成为了全球最流行的网站建设工具之一。它使得网站的创建变得简单易行,不仅适用于个人博客,还广泛应用于企业网站、电子商务平台、新闻网站等各种类型的网站。作为一个开源软件,WordPress拥有一个强大的社区支持和全球化的

安卓系统究竟是不是基于Linux内核?安卓系统究竟是不是基于Linux内核?Mar 14, 2024 pm 03:12 PM

安卓系统究竟是不是基于Linux内核?安卓系统作为目前全球使用最广泛的移动操作系统之一,一直以来都被称为基于Linux内核开发的。然而,真正的情况究竟如何呢?我们来探讨一下这个问题。首先,让我们了解一下Linux内核。Linux内核作为一个开源的操作系统内核,是由LinusTorvalds于1991年首次发布的。它为许多操作系统提供了良好的基础,包括And

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!