rcs.posemath.PmRpy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rcslib Show documentation
Show all versions of rcslib Show documentation
NIST Real-Time Control Systems Library including Posemath, NML communications and Java Plotter
The newest version!
/*
The NIST RCS (Real-time Control Systems)
library is public domain software, however it is preferred
that the following disclaimers be attached.
Software Copywrite/Warranty Disclaimer
This software was developed at the National Institute of Standards and
Technology by employees of the Federal Government in the course of their
official duties. Pursuant to title 17 Section 105 of the United States
Code this software is not subject to copyright protection and is in the
public domain. NIST Real-Time Control System software is an experimental
system. NIST assumes no responsibility whatsoever for its use by other
parties, and makes no guarantees, expressed or implied, about its
quality, reliability, or any other characteristic. We would appreciate
acknowledgement if the software is used. This software can be
redistributed and/or modified freely provided that any derivative works
bear some notice that they are derived from it, and any modified
versions bear some notice that they have been modified.
*/
/*
* New Java File starts here.
* This file should be named PmRpy.java
*/
// Set Package Name
package rcs.posemath;
// Import all NML, CMS, and RCS classes and interfaces
import rcs.nml.NMLFormatConverter;
/*
* Class definition for PmRpy
* Automatically generated by RCS Java Diagnostics Tool.
* on Wed Jan 07 10:53:44 EST 1998
*/
public class PmRpy implements Cloneable {
public double r = 0;
public double p = 0;
public double y = 0;
public void update(NMLFormatConverter nml_fc) {
nml_fc.beginClass("Pmrpy", null);
r = nml_fc.update_with_name("r", r);
p = nml_fc.update_with_name("p", p);
y = nml_fc.update_with_name("y", y);
nml_fc.endClass("Pmrpy", null);
}
public PmRpy(double startr, double startp, double starty) {
r = startr;
p = startp;
y = starty;
}
public PmRpy() {
}
public PmRpy(PmQuaternion q) throws PmException {
Posemath.pmQuatRpyConvert(q, this);
}
@Override
public PmRpy clone() {
PmRpy cloned_object = null;
try {
cloned_object = (PmRpy) super.clone();
}
catch(Exception e){
}
return cloned_object;
}
public String toString() {
norm();
return "{r="+r+",p="+p+",y="+y+"}";
}
/**
* @return the r
*/
public double getR() {
return r;
}
/**
* @param r the r to set
*/
public void setR(double r) {
this.r = r;
}
/**
* @return the p
*/
public double getP() {
return p;
}
/**
* @param p the p to set
*/
public void setP(double p) {
this.p = p;
}
/**
* @return the y
*/
public double getY() {
return y;
}
/**
* @param y the y to set
*/
public void setY(double y) {
this.y = y;
}
public void norm() {
if (r > Math.PI) {
r -= ((int) ((r+Math.PI) / (2 * Math.PI))) * 2 * Math.PI;
} else if (r < -Math.PI) {
r -= ((int) ((r-Math.PI) / (2 * Math.PI))) * 2 * Math.PI;
}
if (p > Math.PI) {
p -= ((int) ((p+Math.PI) / (2 * Math.PI))) * 2 * Math.PI;
} else if (p < -Math.PI) {
p -= ((int) ((p-Math.PI) / (2 * Math.PI))) * 2 * Math.PI;
}
if (y > Math.PI) {
y -= ((int) ((y+Math.PI) / (2 * Math.PI))) * 2 * Math.PI;
} else if (y < -Math.PI) {
y -= ((int) ((y-Math.PI) / (2 * Math.PI))) * 2 * Math.PI;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy