openpnp - modify source code - SlotSchultzFeederConfigurationWizard

本文主要是介绍openpnp - modify source code - SlotSchultzFeederConfigurationWizard,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

    • openpnp - src modify - SlotSchultzFeederConfigurationWizard
    • 概述
    • 笔记
    • 备注
    • END

openpnp - src modify - SlotSchultzFeederConfigurationWizard

概述

在给SlotSchultzFeeder分配元件时, 发现坐标文件中产生的Part名称是拼起来的, 名字很长.
在飞达元件下拉列表中选择时, 看不全, 不放心.
另外基准点元件的名称所在的文本编辑框宽度不够, 显示不全.
选择飞达动作时, 动作的名称也显示不全, 只能看到前半部分.
就想着将SlotSchultzFeeder信息页的UI元素的宽度加大.
改了一下, 好使.
效果如下:
在这里插入图片描述

笔记

提交到本地后, 和上一次的版本进行比对, 发现只改了 D:\my_openpnp\openpnp_github\src\main\java\org\openpnp\machine\reference\feeder\wizards\SlotSchultzFeederConfigurationWizard.java

在这里插入图片描述
在这个文件中, 只改了 SlotSchultzFeederConfigurationWizard(SlotSchultzFeeder feeder), 这个函数是动态设置UI元素的函数.
改动点如下:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

修改后的完整函数如下:

    public SlotSchultzFeederConfigurationWizard(SlotSchultzFeeder feeder) {this.feeder = feeder;JPanel slotPanel = new JPanel();slotPanel.setBorder(new TitledBorder(null, "Slot", TitledBorder.LEADING, TitledBorder.TOP, null, null));contentPanel.add(slotPanel);slotPanel.setLayout(new BoxLayout(slotPanel, BoxLayout.Y_AXIS));JPanel whateverPanel = new JPanel();slotPanel.add(whateverPanel);FormLayout fl_whateverPanel = new FormLayout(new ColumnSpec[] {FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,},new RowSpec[] {FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,});fl_whateverPanel.setColumnGroups(new int[][]{new int[]{4, 6, 8, 10}});whateverPanel.setLayout(fl_whateverPanel);feederNameTf = new JTextField();whateverPanel.add(feederNameTf, "8, 2, 3, 1");feederNameTf.setColumns(10);JPanel panel_1 = new JPanel();FlowLayout flowLayout_1 = (FlowLayout) panel_1.getLayout();flowLayout_1.setAlignment(FlowLayout.LEFT);whateverPanel.add(panel_1, "12, 2");JButton loadFeederBtn = new JButton(loadFeederAction);loadFeederBtn.setToolTipText("Load installed feeder to slot.");panel_1.add(loadFeederBtn);//        JButton newFeederBtn = new JButton(newFeederAction);//        panel_1.add(newFeederBtn);JButton deleteFeederBtn = new JButton(deleteFeederAction);deleteFeederBtn.setToolTipText("Remove selected feeder from database.");panel_1.add(deleteFeederBtn);JLabel lblPickRetryCount = new JLabel("Pick Retry Count");whateverPanel.add(lblPickRetryCount, "2, 12, right, default");pickRetryCount = new JTextField();pickRetryCount.setColumns(10);whateverPanel.add(pickRetryCount, "4, 12, fill, default");JLabel lblBank = new JLabel("Bank");whateverPanel.add(lblBank, "2, 14, right, default");bankCb = new JComboBox();whateverPanel.add(bankCb, "4, 14, 3, 1");bankCb.addActionListener(e -> {feederCb.removeAllItems();Bank bank = (Bank) bankCb.getSelectedItem();feederCb.addItem(null);if (bank != null) {for (Feeder f : bank.getFeeders()) {feederCb.addItem(f);}}});JLabel lblFeeder = new JLabel("Feeder");whateverPanel.add(lblFeeder, "2, 2, right, default");feederCb = new JComboBox();whateverPanel.add(feederCb, "4, 2, 3, 1");JPanel feederPanel = new JPanel();feederPanel.setBorder(new TitledBorder(null, "Feeder", TitledBorder.LEADING, TitledBorder.TOP, null));contentPanel.add(feederPanel);FormLayout fl_feederPanel = new FormLayout(new ColumnSpec[] {FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,},new RowSpec[] {FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,});fl_feederPanel.setColumnGroups(new int[][]{new int[]{4, 6, 8, 10}});feederPanel.setLayout(fl_feederPanel);JLabel lblX_1 = new JLabel("X");feederPanel.add(lblX_1, "4, 2");JLabel lblY_1 = new JLabel("Y");feederPanel.add(lblY_1, "6, 2");JLabel lblZ_1 = new JLabel("Z");feederPanel.add(lblZ_1, "8, 2");JLabel lblRotation_1 = new JLabel("Rotation");feederPanel.add(lblRotation_1, "10, 2");JLabel lblOffsets = new JLabel("Offsets");feederPanel.add(lblOffsets, "2, 4");xOffsetTf = new JTextField();feederPanel.add(xOffsetTf, "4, 4");xOffsetTf.setColumns(10);yOffsetTf = new JTextField();feederPanel.add(yOffsetTf, "6, 4");yOffsetTf.setColumns(10);zOffsetTf = new JTextField();feederPanel.add(zOffsetTf, "8, 4");zOffsetTf.setColumns(10);rotOffsetTf = new JTextField();feederPanel.add(rotOffsetTf, "10, 4");rotOffsetTf.setColumns(10);//        offsetLocButtons = new LocationButtonsPanel(xOffsetTf, yOffsetTf, zOffsetTf, rotOffsetTf);offsetLocButtons = new LocationButtonsPanel(xOffsetTf, yOffsetTf, zOffsetTf, null);feederPanel.add(offsetLocButtons, "12, 4");JLabel lblPart = new JLabel("Part");feederPanel.add(lblPart, "2, 6, right, default");feederPartCb = new JComboBox();feederPanel.add(feederPartCb, "4, 6, 9, 1"); // 增加飞达对应元件的显示名称的下拉列表框宽度, param3 is wfeederPartCb.setModel(new PartsComboBoxModel());feederPartCb.setRenderer(new IdentifiableListCellRenderer<Part>());JPanel panelActuator = new JPanel();panelActuator.setBorder(new TitledBorder(null,"Actuators", TitledBorder.LEADING, TitledBorder.TOP, null));contentPanel.add(panelActuator);// 定义子面板布局的坐标行列数, 元素放置都是根据几行几列作为位置来放的.FormLayout fl_panelActuator = new FormLayout(new ColumnSpec[] {FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC,FormSpecs.RELATED_GAP_COLSPEC,FormSpecs.DEFAULT_COLSPEC},new RowSpec[] {FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC,FormSpecs.RELATED_GAP_ROWSPEC,FormSpecs.DEFAULT_ROWSPEC});fl_panelActuator.setColumnGroups(new int[][]{new int[]{4, 6, 8, 10}});panelActuator.setLayout(fl_panelActuator);JLabel lblActuatorValue = new JLabel("Feeder Number:");panelActuator.add(lblActuatorValue, "4, 2, right, default");actuatorValue = new JTextField();panelActuator.add(actuatorValue, "6, 2");actuatorValue.setColumns(6);JLabel lblActuator = new JLabel("Actuator");panelActuator.add(lblActuator, "4, 4, left, default");// get id 那行的UI元素JLabel lblGetID = new JLabel("Get ID");panelActuator.add(lblGetID, "2, 6, right, default");comboBoxIdActuator = new JComboBox();comboBoxIdActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxIdActuator, "4, 6, fill, default");btnIdActuator = new JButton(getIdActuatorAction);panelActuator.add(btnIdActuator, "6, 6");idText = new JTextField();idText.setColumns(10);panelActuator.add(idText, "8, 6");// pre pick 那行的UI元素JLabel lblFeed = new JLabel("Pre Pick");panelActuator.add(lblFeed, "2, 8, right, default");comboBoxFeedActuator = new JComboBox();comboBoxFeedActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxFeedActuator, "4, 8, fill, default");btnTestFeedActuator = new JButton(testFeedActuatorAction);panelActuator.add(btnTestFeedActuator, "6, 8");JLabel lblPostPick = new JLabel("Post Pick");panelActuator.add(lblPostPick, "2, 10, right, default");comboBoxPostPickActuator = new JComboBox();comboBoxPostPickActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxPostPickActuator, "4, 10, fill, default");btnTestPostPickActuator = new JButton(testPostPickActuatorAction);panelActuator.add(btnTestPostPickActuator, "6, 10");JLabel lblFeedCount = new JLabel("Get Feed Count");panelActuator.add(lblFeedCount, "2, 12, right, default");comboBoxFeedCountActuator = new JComboBox();comboBoxFeedCountActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxFeedCountActuator, "4, 12, fill, default");btnGetFeedCountActuator = new JButton(getFeedCountActuatorAction);panelActuator.add(btnGetFeedCountActuator, "6, 12");feedCountValue = new JTextField();feedCountValue.setColumns(8);panelActuator.add(feedCountValue, "8, 12");JLabel lblClearCount = new JLabel("Clear Feed Count");panelActuator.add(lblClearCount, "2, 14, right, default");comboBoxClearCountActuator = new JComboBox();comboBoxClearCountActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxClearCountActuator, "4, 14, fill, default");btnClearCountActuator = new JButton(clearCountActuatorAction);panelActuator.add(btnClearCountActuator, "6, 14");JLabel lblGetPitch = new JLabel("Get Pitch");panelActuator.add(lblGetPitch, "2, 16, right, default");comboBoxPitchActuator = new JComboBox();comboBoxPitchActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxPitchActuator, "4, 16, fill, default");btnPitchActuator = new JButton(pitchActuatorAction);panelActuator.add(btnPitchActuator, "6, 16");pitchValue = new JTextField();pitchValue.setColumns(8);panelActuator.add(pitchValue, "8, 16");JLabel lblTogglePitch = new JLabel("Toggle Pitch");panelActuator.add(lblTogglePitch, "2, 18, right, default");comboBoxTogglePitchActuator = new JComboBox();comboBoxTogglePitchActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxTogglePitchActuator, "4, 18, fill, default");btnTogglePitchActuator = new JButton(togglePitchActuatorAction);panelActuator.add(btnTogglePitchActuator, "6, 18");JLabel lblTogglePitchDesc = new JLabel("Toggle between 2 MM and 4 MM");panelActuator.add(lblTogglePitchDesc, "8, 18, left, default");JLabel lblGetStatus = new JLabel("Get Status");panelActuator.add(lblGetStatus, "2, 20, right, default");comboBoxStatusActuator = new JComboBox();comboBoxStatusActuator.setModel(new ActuatorsComboBoxModel(Configuration.get().getMachine()));panelActuator.add(comboBoxStatusActuator, "4, 20, fill, default");btnStatusActuator = new JButton(statusActuatorAction);panelActuator.add(btnStatusActuator, "6, 20");statusText = new JTextField();statusText.setColumns(50);panelActuator.add(statusText, "8, 20");if(Configuration.get().getMachine().isEnabled()){// 命令不能并发, 下位机处理不过来.my_delay_ms(300);getIdActuatorAction.actionPerformed(null);my_delay_ms(300);getFeedCountActuatorAction.actionPerformed(null);my_delay_ms(300);pitchActuatorAction.actionPerformed(null);my_delay_ms(300);statusActuatorAction.actionPerformed(null);}for (Bank bank : SlotSchultzFeeder.getBanks()) {bankCb.addItem(bank);}feederCb.addItem(null);JLabel lblX = new JLabel("X");whateverPanel.add(lblX, "4, 4, center, default");JLabel lblY = new JLabel("Y");whateverPanel.add(lblY, "6, 4, center, default");JLabel lblZ = new JLabel("Z");whateverPanel.add(lblZ, "8, 4, center, default");JLabel lblRotation = new JLabel("Rotation");whateverPanel.add(lblRotation, "10, 4, center, default");JLabel lblPickLocation = new JLabel("Location");whateverPanel.add(lblPickLocation, "2, 6, right, default");xPickLocTf = new JTextField();whateverPanel.add(xPickLocTf, "4, 6");xPickLocTf.setColumns(10);yPickLocTf = new JTextField();whateverPanel.add(yPickLocTf, "6, 6");yPickLocTf.setColumns(10);zPickLocTf = new JTextField();whateverPanel.add(zPickLocTf, "8, 6");zPickLocTf.setColumns(10);pickLocButtons = new LocationButtonsPanel(xPickLocTf, yPickLocTf, zPickLocTf, rotPickLocTf);rotPickLocTf = new JTextField();whateverPanel.add(rotPickLocTf, "10, 6");rotPickLocTf.setColumns(10);whateverPanel.add(pickLocButtons, "12, 6");JButton fiducialAlign = new JButton(updateLocationAction);whateverPanel.add(fiducialAlign, "14, 6");fiducialAlign.setIcon(Icons.fiducialCheck);fiducialAlign.setToolTipText("Update feeder location based on fiducial");JLabel lblFiducialPart = new JLabel("Fiducial Part");whateverPanel.add(lblFiducialPart, "2, 8, right, default");fiducialPartTf = new JTextField();// 参数2字符串为 "x, y, w, h", 增加w, 就是增加文本输入框的宽度whateverPanel.add(fiducialPartTf, "4, 8, 8, 1"); // 增加飞达基准孔部件名称文本框的宽度, 参数3改大了.fiducialPartTf.addActionListener(e -> {feeder.setFiducialPart(fiducialPartTf.getText());});JLabel lblFeedRetryCount = new JLabel("Feed Retry Count");whateverPanel.add(lblFeedRetryCount, "2, 10, right, default");feedRetryCount = new JTextField();whateverPanel.add(feedRetryCount, "4, 10");feedRetryCount.setColumns(10);bankNameTf = new JTextField();whateverPanel.add(bankNameTf, "8, 14, 3, 1");bankNameTf.setColumns(10);JPanel panel = new JPanel();FlowLayout flowLayout = (FlowLayout) panel.getLayout();flowLayout.setAlignment(FlowLayout.LEFT);whateverPanel.add(panel, "12, 14");JButton newBankBtn = new JButton(newBankAction);panel.add(newBankBtn);JButton deleteBankBtn = new JButton(deleteBankAction);panel.add(deleteBankBtn);if (feeder.getBank() != null) {for (Feeder f : feeder.getBank().getFeeders()) {feederCb.addItem(f);}}}

备注

对java不熟, 边改边实验看效果.
改完没啥不良反应.

突然发现, 官方代码的2022/8/1那天上午的最后的代码, 并不是官方打包的代码实现.
因为我发现我现在基于2022/8/1那天改动的代码, 引入坐标文件后, package封装中的参数多了一个pad-pitch字段, 官方版本(dev-2022-0801)不认得.
在这里插入图片描述
在这里插入图片描述
等有时间得确认一下, 官方dev-2022/8/1 那个版本, 到底是从哪个代码上编译出来的?

END

这篇关于openpnp - modify source code - SlotSchultzFeederConfigurationWizard的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/300430

相关文章

Debugging Lua Project created in Cocos Code IDE creates “Waiting for debugger to connect” in Win-7

转自 I Installed Cocos Code IDE and created a new Lua Project. When Debugging the Project(F11) the game window pops up and gives me the message waiting for debugger to connect and then freezes. Also a

10 Source-Get-Post-JsonP 网络请求

划重点 使用vue-resource.js库 进行网络请求操作POST : this.$http.post ( … )GET : this.$http.get ( … ) 小鸡炖蘑菇 <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-w

LLVM入门2:如何基于自己的代码生成IR-LLVM IR code generation实例介绍

概述 本节将通过一个简单的例子来介绍如何生成llvm IR,以Kaleidoscope IR中的例子为例,我们基于LLVM接口构建一个简单的编译器,实现简单的语句解析并转化为LLVM IR,生成对应的LLVM IR部分,代码如下,文件名为toy.cpp,先给出代码,后面会详细介绍每一步分代码: #include "llvm/ADT/APFloat.h"#include "llvm/ADT/S

VS Code 调试go程序的相关配置说明

用 VS code 调试Go程序需要在.vscode/launch.json文件中增加如下配置:  // launch.json{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information,

fetch-event-source 如何通过script全局引入

fetchEventSource源码中导出了两种类型的包cjs和esm。但是有个需求如何在原生是js中通过script标签引呢?需要加上type=module。今天介绍另一种方法 下载源码文件: https://github.com/Azure/fetch-event-source.git 安装: npm install --save-dev webpack webpack-cli ts

code: 400, msg: Required request body is missing 错误解决

引起这个错误的原因是,请求参数按照get方式给。 应该给json字符串才对 补充: 1. @RequestBody String resource 加@RequestBody必须给json字符串,否则会报错400,记如标题错误。 不加这个的进行请求的话,其实post和get就没有什么区别了。 2. List<String> indexCodes=(List<String>)json.

iOS项目发布提交出现invalid code signing entitlements错误。

1、进入开发者账号,选择App IDs,找到自己项目对应的AppId,点击进去编辑, 2、看下错误提示出现  --Specifically, value "CVYZ6723728.*" for key "com.apple.developer.ubiquity-container-identifiers" in XX is not supported.-- 这样的错误提示 将ubiquity

解决服务器VS Code中Jupyter突然崩溃的问题

问题 本来在服务器Anaconda的Python环境里装其他的包,装完了想在Jupyter里写代码验证一下有没有装好,一运行发现Jupyter崩溃了!?报错如下所示 Failed to start the Kernel. ImportError: /home/hujh/anaconda3/envs/mia/lib/python3.12/lib-dynload/_sqlite3.cpython-

Open Source, Open Life 第九届中国开源年会论坛征集正式启动

中国开源年会 COSCon 是业界最具影响力的开源盛会之一,由开源社在2015年首次发起,而今年我们将迎来第九届 COSCon! 以其独特定位及日益增加的影响力,COSCon 吸引了越来越多的国内外企业、高校、开源组织/社区的大力支持。与一般企业、IT 媒体、行业协会举办的行业大会不同,COSCon 具有跨组织、跨项目、跨社区的广泛覆盖面,也吸引了众多国内外开源开发者和开源爱好者的关注及参与

Behind the Code:与 Rakic 和 Todorovic 对话 OriginTrail 如何实现 AI 去中心化

原文:https://www.youtube.com/watch?v=ZMuLyLCtE3s&list=PLtyd7v_I7PGnko80O0LCwQQsvhwAMu9cv&index=12 作者:The Kusamarian 编译:OneBlock+ 随着人工智能技术的飞速发展,一系列前所未有的挑战随之而来:模型的衰退与互联网的潜在威胁愈发明显。AI 的增长曲线可能因训练过程中的瓶颈而趋于平