SunriseWorkbench codes need explanation

My issue does not really stem from any error in my code, but rather i do not understand the code my school is teaching me on a fundamental level. So if any of you work close with kuka robots or sunrise workbench I would really appreciate if you could help me with thes

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>package server;//where the application is located
import javax.inject.Inject;//for @inject functions
import com.kuka.nav.Location;
import com.kuka.nav.OrientationMode;
import com.kuka.nav.Orientations;
import com.kuka.nav.Pose;
import com.kuka.nav.XYTheta;
import com.kuka.nav.data.LocationData;
import com.kuka.nav.line.VirtualLine;
import com.kuka.nav.line.VirtualLineMotion;
import com.kuka.nav.rel.RelativeMotion;
import com.kuka.nav.robot.MobileRobot;
import com.kuka.nav.robot.MobileRobotManager;
import com.kuka.nav.task.NavTaskCategory;
import com.kuka.resource.locking.LockException;
import com.kuka.task.ITaskLogger;
import com.kuka.task.RoboticsAPITask;
@NavTaskCategory // the function dictates the nav server codes.
public class P01S_DMRO3A01_IsaiahYeong extends RoboticsAPITask {
// the roboticsapi task super class is used to create the public class called ex01relative motion
@Inject//inject is for a method
private MobileRobotManager _robMan; //for the sever, you need smth to manage it
private MobileRobot _rob;// To create a mobilerobot object called _ rob, also has a mobilerobot datatype
@Inject
private LocationData _locDat;
@Inject
private ITaskLogger _log;//communicates to console
private int _robotId;
// -------------------------------------------------------------------
@Override//meant for object
public void initialize() throws Exception {
// real robot ID 1
// a place to store variables
_robotId = 1; //tagging the robot with id number 1
_rob = _robMan.getRobot(_robotId);
_log.info("Initialize finished.");//to indicate in console that initialising is done
}
// -------------------------------------------------------------------
@Override
public void run() throws Exception {
_log.info("Starting application...");
try {
_rob.lock();//when the robot is locked you have control
executeViLiMoToPose();
} catch (LockException e) {
_log.error("Already locked.", e);
} catch (InterruptedException e) {
_log.error("Interrupted.", e);
} finally {
_rob.unlock();
}
_log.info("Application finished.");
}
// -------------------------------------------------------------------
private void executeViLiMoToPose() {
_log.info("Method executeApplication started.");
//Get locations
Location Home = _locDat.get(278); //get home location ID
Location goalLoc2 = _locDat.get(280); //get goal 2 location ID
//setting velocity
XYTheta vel = new XYTheta(0.2, 0.2, Math.toRadians(10));//setting velocity for x,y, theta
//move to home
VirtualLineMotion MotionHome = new VirtualLineMotion(_rob.getPose(),Home.getPose());
MotionHome.setVelocityOverride(vel);
_rob.execute(MotionHome);
//GOALPOSE 1
Pose StartPos = _rob.getPose();
Pose goalPose1 = new Pose(_rob.getPose().getX()+0.7, _rob.getPose().getY(),
_rob.getPose().getTheta());//gets its current position, when retrieving its x axis adds 0.8m and makes it goalPose1
//orientations
Orientations ori1 = Orientations.map(Math.toRadians(-30));//Creates a variable called ori1 that moves the robot -30 degrees theta
VirtualLine VirtLi1 = VirtualLine.from(StartPos.toPosition()).to(goalPose1.toPosition());// VirtLi1 is set to move to goalpose 1 from starting position using virtual line
VirtualLineMotion Motion1 = new VirtualLineMotion(VirtLi1,ori1 , OrientationMode.VARIABLE);//Motion 1 is created with Orientation and VirtLi data
Motion1.setVelocityOverride(vel);//velocity for Motion 1 is set
_rob.execute(Motion1);//Motion 1 is executed
//GOALPOSE 2
VirtualLineMotion Motion2 = new VirtualLineMotion(_rob.getPose(),goalLoc2.getPose());//gets its current position and gets the location of goalpose and figures out how to navigate the way there
Motion2.setVelocityOverride(vel);//velocity for Motion 2 is set
_rob.execute(Motion2);//Motion 2 is executed
//GOALPOSE 3
RelativeMotion Motion3 = new RelativeMotion(-0.7, 0, Math.toRadians(30));//moves the robot -0.8m on the x axis relative to where it currently is and rotates it 30 degrees relative to its prior orientation
Motion3.setVelocityOverride(vel);//velocity for Motion 3 is set
_rob.execute(Motion3);//Motion 3 is executed
//move back to home
VirtualLineMotion MotionHome2 = new VirtualLineMotion(_rob.getPose(),Home.getPose());//gets its current position and gets the location of Home and figures out how to navigate the way there
MotionHome2.setVelocityOverride(vel);//velocity for motionHome2 is set
_rob.execute(MotionHome2);//executes the command motionHome2
_log.info("program finished");
}
// -------------------------------------------------------------------
@Override
public void dispose() throws Exception {
_log.info("Dispose finished.");
}
}
</code>
<code>package server;//where the application is located import javax.inject.Inject;//for @inject functions import com.kuka.nav.Location; import com.kuka.nav.OrientationMode; import com.kuka.nav.Orientations; import com.kuka.nav.Pose; import com.kuka.nav.XYTheta; import com.kuka.nav.data.LocationData; import com.kuka.nav.line.VirtualLine; import com.kuka.nav.line.VirtualLineMotion; import com.kuka.nav.rel.RelativeMotion; import com.kuka.nav.robot.MobileRobot; import com.kuka.nav.robot.MobileRobotManager; import com.kuka.nav.task.NavTaskCategory; import com.kuka.resource.locking.LockException; import com.kuka.task.ITaskLogger; import com.kuka.task.RoboticsAPITask; @NavTaskCategory // the function dictates the nav server codes. public class P01S_DMRO3A01_IsaiahYeong extends RoboticsAPITask { // the roboticsapi task super class is used to create the public class called ex01relative motion @Inject//inject is for a method private MobileRobotManager _robMan; //for the sever, you need smth to manage it private MobileRobot _rob;// To create a mobilerobot object called _ rob, also has a mobilerobot datatype @Inject private LocationData _locDat; @Inject private ITaskLogger _log;//communicates to console private int _robotId; // ------------------------------------------------------------------- @Override//meant for object public void initialize() throws Exception { // real robot ID 1 // a place to store variables _robotId = 1; //tagging the robot with id number 1 _rob = _robMan.getRobot(_robotId); _log.info("Initialize finished.");//to indicate in console that initialising is done } // ------------------------------------------------------------------- @Override public void run() throws Exception { _log.info("Starting application..."); try { _rob.lock();//when the robot is locked you have control executeViLiMoToPose(); } catch (LockException e) { _log.error("Already locked.", e); } catch (InterruptedException e) { _log.error("Interrupted.", e); } finally { _rob.unlock(); } _log.info("Application finished."); } // ------------------------------------------------------------------- private void executeViLiMoToPose() { _log.info("Method executeApplication started."); //Get locations Location Home = _locDat.get(278); //get home location ID Location goalLoc2 = _locDat.get(280); //get goal 2 location ID //setting velocity XYTheta vel = new XYTheta(0.2, 0.2, Math.toRadians(10));//setting velocity for x,y, theta //move to home VirtualLineMotion MotionHome = new VirtualLineMotion(_rob.getPose(),Home.getPose()); MotionHome.setVelocityOverride(vel); _rob.execute(MotionHome); //GOALPOSE 1 Pose StartPos = _rob.getPose(); Pose goalPose1 = new Pose(_rob.getPose().getX()+0.7, _rob.getPose().getY(), _rob.getPose().getTheta());//gets its current position, when retrieving its x axis adds 0.8m and makes it goalPose1 //orientations Orientations ori1 = Orientations.map(Math.toRadians(-30));//Creates a variable called ori1 that moves the robot -30 degrees theta VirtualLine VirtLi1 = VirtualLine.from(StartPos.toPosition()).to(goalPose1.toPosition());// VirtLi1 is set to move to goalpose 1 from starting position using virtual line VirtualLineMotion Motion1 = new VirtualLineMotion(VirtLi1,ori1 , OrientationMode.VARIABLE);//Motion 1 is created with Orientation and VirtLi data Motion1.setVelocityOverride(vel);//velocity for Motion 1 is set _rob.execute(Motion1);//Motion 1 is executed //GOALPOSE 2 VirtualLineMotion Motion2 = new VirtualLineMotion(_rob.getPose(),goalLoc2.getPose());//gets its current position and gets the location of goalpose and figures out how to navigate the way there Motion2.setVelocityOverride(vel);//velocity for Motion 2 is set _rob.execute(Motion2);//Motion 2 is executed //GOALPOSE 3 RelativeMotion Motion3 = new RelativeMotion(-0.7, 0, Math.toRadians(30));//moves the robot -0.8m on the x axis relative to where it currently is and rotates it 30 degrees relative to its prior orientation Motion3.setVelocityOverride(vel);//velocity for Motion 3 is set _rob.execute(Motion3);//Motion 3 is executed //move back to home VirtualLineMotion MotionHome2 = new VirtualLineMotion(_rob.getPose(),Home.getPose());//gets its current position and gets the location of Home and figures out how to navigate the way there MotionHome2.setVelocityOverride(vel);//velocity for motionHome2 is set _rob.execute(MotionHome2);//executes the command motionHome2 _log.info("program finished"); } // ------------------------------------------------------------------- @Override public void dispose() throws Exception { _log.info("Dispose finished."); } } </code>
package server;//where the application is located

import javax.inject.Inject;//for @inject functions




import com.kuka.nav.Location;
import com.kuka.nav.OrientationMode;
import com.kuka.nav.Orientations;
import com.kuka.nav.Pose;

import com.kuka.nav.XYTheta;
import com.kuka.nav.data.LocationData;
import com.kuka.nav.line.VirtualLine;
import com.kuka.nav.line.VirtualLineMotion;
import com.kuka.nav.rel.RelativeMotion;
import com.kuka.nav.robot.MobileRobot;
import com.kuka.nav.robot.MobileRobotManager;
import com.kuka.nav.task.NavTaskCategory;
import com.kuka.resource.locking.LockException;
import com.kuka.task.ITaskLogger;
import com.kuka.task.RoboticsAPITask;


@NavTaskCategory // the function dictates the nav server codes.
public class P01S_DMRO3A01_IsaiahYeong extends RoboticsAPITask {
    // the roboticsapi task super class is used to create the public class called ex01relative motion

    @Inject//inject is for a method
    private MobileRobotManager _robMan; //for the sever, you need smth to manage it
    private MobileRobot _rob;// To create a mobilerobot object called _ rob, also has a mobilerobot datatype
    @Inject
    private LocationData _locDat;
    @Inject
    private ITaskLogger _log;//communicates to console
    
    private int _robotId;

    

    // -------------------------------------------------------------------
    
    @Override//meant for object
    public void initialize() throws Exception {
        // real robot ID 1
        // a place to store variables 
    
        _robotId = 1;   //tagging the robot with id number 1
        _rob = _robMan.getRobot(_robotId);
        _log.info("Initialize finished.");//to indicate in console that initialising is done
    }

    // -------------------------------------------------------------------

    @Override
    public void run() throws Exception {
        _log.info("Starting application...");

        try {
            _rob.lock();//when the robot is locked you have control

            executeViLiMoToPose();

        } catch (LockException e) {
            _log.error("Already locked.", e);
        } catch (InterruptedException e) {
            _log.error("Interrupted.", e);
        } finally {
            _rob.unlock();
        }

        _log.info("Application finished.");
    }
    
    // -------------------------------------------------------------------

    private void executeViLiMoToPose() {
        _log.info("Method executeApplication started.");
        
        
        //Get locations
        
        Location Home = _locDat.get(278); //get home location ID
        Location goalLoc2 = _locDat.get(280); //get goal 2 location ID
        
        //setting velocity
        XYTheta vel = new XYTheta(0.2, 0.2, Math.toRadians(10));//setting velocity for x,y, theta
        
        
        //move to home
        VirtualLineMotion MotionHome = new VirtualLineMotion(_rob.getPose(),Home.getPose());
        MotionHome.setVelocityOverride(vel);
        _rob.execute(MotionHome);
        
        //GOALPOSE 1
        Pose StartPos = _rob.getPose();
        Pose goalPose1 = new Pose(_rob.getPose().getX()+0.7, _rob.getPose().getY(),
                _rob.getPose().getTheta());//gets its current position, when retrieving its x axis adds 0.8m and makes it goalPose1
        
        
        //orientations
        
        Orientations ori1 = Orientations.map(Math.toRadians(-30));//Creates a variable called ori1 that moves the robot -30 degrees theta
        VirtualLine VirtLi1 = VirtualLine.from(StartPos.toPosition()).to(goalPose1.toPosition());// VirtLi1 is set to move to goalpose 1 from starting position using virtual line
        VirtualLineMotion Motion1 = new VirtualLineMotion(VirtLi1,ori1 , OrientationMode.VARIABLE);//Motion 1 is created with Orientation and VirtLi data
        Motion1.setVelocityOverride(vel);//velocity for Motion 1 is set
        _rob.execute(Motion1);//Motion 1 is executed
        
        
        //GOALPOSE 2
        
        VirtualLineMotion Motion2 = new VirtualLineMotion(_rob.getPose(),goalLoc2.getPose());//gets its current position and gets the location of goalpose and figures out how to navigate the way there
        Motion2.setVelocityOverride(vel);//velocity for Motion 2 is set
        _rob.execute(Motion2);//Motion 2 is executed
        
        
        
        //GOALPOSE 3
        RelativeMotion Motion3 = new RelativeMotion(-0.7, 0, Math.toRadians(30));//moves the robot -0.8m on the x axis relative to where it currently is and rotates it 30 degrees relative to its prior orientation 
        Motion3.setVelocityOverride(vel);//velocity for Motion 3 is set
        _rob.execute(Motion3);//Motion 3 is executed
        
        
        
        //move back to home
        
        
        VirtualLineMotion MotionHome2 = new VirtualLineMotion(_rob.getPose(),Home.getPose());//gets its current position and gets the location of Home and figures out how to navigate the way there
        MotionHome2.setVelocityOverride(vel);//velocity for motionHome2 is set
        _rob.execute(MotionHome2);//executes the command motionHome2
        
        
        
        
        
        
        
        

        
    
        
        
        _log.info("program finished");
        
        
        

    }
    
    // -------------------------------------------------------------------
    
    @Override
    public void dispose() throws Exception {
        _log.info("Dispose finished.");
    }
}

The main things that will need explanation is Virtuallinemotion and //orientations part. feel free to correct any misunderstandings that you might see in the code above

I have tried looking for documentation on the libraries and functions and i could only find documentation for the iiwa arm hence why i am asking here instead. if documentation exists out there I would really appreciate if you could link them below. Thank you so much for your patience and kindness!

New contributor

bap bop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật