ParseInput.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:Robot_2016 作者:
public static ArrayList<Command> takeInput(String movement, boolean isRev, int shooting)
{
    auto_Commands = new ArrayList<Command>(0);
    if(movement.charAt(0) == 'f')
        auto_Commands.add(new MoveForward(Double.valueOf(movement.substring(1))));
    else if(movement.charAt(0) == 'r')
        auto_Commands.add(new RotateAngle(Double.valueOf(movement.substring(1))));
    else if(movement.charAt(0) == 's')
        auto_Commands.add(new SpyBot(shooting));
    //else if(movement.charAt(0) == 'l')
    //  auto_Commands.add(new CrossLowbar());

    if(isRev == true && movement.charAt(0) == 'f')
        auto_Commands.add(new MoveForward(-0.65*Double.valueOf(movement.substring(1)))); //This has the 0.65 because we don't want to accidentially cross the autoline when we go back


    return auto_Commands; //an arraylist of the commands to be executed in autonomous
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号