Merge pull request '更新代码' (#20) from Huatao_branch into master
	
		
	
				
					
				
			
						commit
						e92f251c39
					
				| @ -0,0 +1,53 @@ | ||||
| package com.example.testdemo.entity; | ||||
| 
 | ||||
| public class Good { | ||||
|     private int id; | ||||
|     private String phoneNum; | ||||
|     private int shelfNum; | ||||
|     private int floorNum; | ||||
|     private String time; | ||||
| 
 | ||||
|     public Good(){ | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public int getId(){ | ||||
|         return  id; | ||||
|     } | ||||
| 
 | ||||
|     public void setId(int id){ | ||||
|         this.id = id; | ||||
|     } | ||||
| 
 | ||||
|     public String getPhoneNum(){ | ||||
|         return phoneNum; | ||||
|     } | ||||
| 
 | ||||
|     public void setPhoneNum(String phoneNum){ | ||||
|         this.phoneNum = phoneNum; | ||||
|     } | ||||
| 
 | ||||
|     public int getShelfNum(){ | ||||
|         return shelfNum; | ||||
|     } | ||||
| 
 | ||||
|     public void setShelfNum(int shelfNum){ | ||||
|         this.shelfNum = shelfNum; | ||||
|     } | ||||
| 
 | ||||
|     public int getFloorNum(){ | ||||
|         return floorNum; | ||||
|     } | ||||
| 
 | ||||
|     public void setFloorNum(int floorNum){ | ||||
|         this.floorNum = floorNum; | ||||
|     } | ||||
| 
 | ||||
|     public String getTime(){ | ||||
|         return time; | ||||
|     } | ||||
|     public void setTime(String time){ | ||||
|         this.time = time; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,46 @@ | ||||
| package com.example.testdemo.entity; | ||||
| 
 | ||||
| 
 | ||||
| public class Operation { | ||||
|     private int id; | ||||
|     private String pickUpCode; | ||||
|     private String phoneNum; | ||||
|     private String time; | ||||
| 
 | ||||
|     public Operation(){ | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public int getId(){ | ||||
|         return id; | ||||
|     } | ||||
| 
 | ||||
|     public void setId(int id){ | ||||
|         this.id = id; | ||||
|     } | ||||
| 
 | ||||
|     public String getPickUpCode(){ | ||||
|         return pickUpCode; | ||||
|     } | ||||
| 
 | ||||
|     public void setPickUpCode(String PickUpCode){ | ||||
|         this.pickUpCode =  PickUpCode; | ||||
|     } | ||||
| 
 | ||||
|     public String getPhoneNum(){ | ||||
|         return phoneNum; | ||||
|     } | ||||
| 
 | ||||
|     public void setPhoneNum(String PhoneNum){ | ||||
|         this.phoneNum = PhoneNum; | ||||
|     } | ||||
| 
 | ||||
|     public String getTime(){ | ||||
|         return time; | ||||
|     } | ||||
| 
 | ||||
|     public void setTime(String time){ | ||||
|         this.time = time; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,16 @@ | ||||
| package com.example.testdemo.manager; | ||||
| 
 | ||||
| import com.example.testdemo.entity.Good; | ||||
| import org.springframework.stereotype.Repository; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| @org.apache.ibatis.annotations.Mapper | ||||
| @Repository | ||||
| public interface GoodManager { | ||||
|      List<Good> queryGoodsById(int id); | ||||
| 
 | ||||
|      List<Good> queryGoodsByPhonenum(String phonenum); | ||||
| 
 | ||||
|      void delete(int id); | ||||
| } | ||||
| @ -0,0 +1,18 @@ | ||||
| package com.example.testdemo.manager; | ||||
| 
 | ||||
| 
 | ||||
| import com.example.testdemo.entity.Operation; | ||||
| import jdk.nashorn.internal.runtime.OptimisticReturnFilters; | ||||
| import org.springframework.stereotype.Repository; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| @org.apache.ibatis.annotations.Mapper | ||||
| @Repository | ||||
| public interface OperationManager { | ||||
| 
 | ||||
|     void addOperation(String pickupcode, String phonenum, String time); | ||||
| 
 | ||||
|     List<Operation> queryOperationsByPhone(String phonenum); | ||||
| 
 | ||||
| } | ||||
| @ -1,4 +1,4 @@ | ||||
| package com.example.testdemo.config; | ||||
| package com.example.testdemo.manager; | ||||
| 
 | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| @ -1 +0,0 @@ | ||||
| 
 | ||||
| @ -0,0 +1,15 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper | ||||
|         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.example.testdemo.manager.GoodManager"> | ||||
|     <select id="queryGoodsById" resultType="Good" parameterType="int"> | ||||
|         select * from goods where id = #{id}; | ||||
|     </select> | ||||
|     <delete id="deleteGoods" parameterType="int"> | ||||
|         delete from goods where id = #{id}; | ||||
|     </delete> | ||||
|     <select id="queryGoodsByPhone" resultType="Good" parameterType="String"> | ||||
|         select * from goods where phonenum = #{phonenum}; | ||||
|     </select> | ||||
| </mapper> | ||||
| @ -0,0 +1,12 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper | ||||
|         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.example.testdemo.manager.OperationManager"> | ||||
|     <insert id = "addOperation" parameterType="String"> | ||||
|         insert into operations(pickupcode, phonenum, time) values (#{pickupcode},#{phonenum},#{time})}) | ||||
|     </insert> | ||||
|     <select id="queryOperationsByPhone" resultType="Operation" parameterType="String"> | ||||
|         select * from goods where id = #{phonenum}; | ||||
|     </select> | ||||
| </mapper> | ||||
| @ -1,97 +0,0 @@ | ||||
| 
 | ||||
|    // document.write('<script type="text/javascript" src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>\n');
 | ||||
|    // document.write('<script type="text/javascript" src="http://cdn.robotwebtools.org/roslibjs/current/roslib.min.js"></script>\n');
 | ||||
| 
 | ||||
|     var ros = new ROSLIB.Ros({ | ||||
|     url : 'ws://192.168.43.20:9090' | ||||
| }); | ||||
| 
 | ||||
|     ros.on('connection', function() { | ||||
|     console.log('Connected to websocket server.'); | ||||
| }); | ||||
| 
 | ||||
|     ros.on('error', function(error) { | ||||
|     console.log('Error connecting to websocket server: ', error); | ||||
| }); | ||||
| 
 | ||||
|     ros.on('close', function() { | ||||
|     console.log('Connection to websocket server closed.'); | ||||
| }); | ||||
|    var move_base= new ROSLIB.ActionClient({ | ||||
|        ros : ros, | ||||
|        serverName : '/move_base', | ||||
|        actionName : 'move_base_msgs/MoveBaseAction' | ||||
|    }); | ||||
| 
 | ||||
|    var currentTime = new Date(); | ||||
|    var secs = Math.floor(currentTime.getTime()/1000) | ||||
|    var nsecs = Math.round(1000000000*(currentTime.getTime()/1000-secs)) | ||||
| 
 | ||||
|    var goal = new ROSLIB.Goal({ | ||||
|        actionClient: move_base, | ||||
|        goalMessage:{ | ||||
|            target_pose:{ | ||||
|                header:{ | ||||
|                    frame_id:'map', | ||||
|                    stamp:{ | ||||
|                        secs: secs, | ||||
|                        nsecs:nsecs | ||||
|                    } | ||||
|                }, | ||||
|                pose:{ | ||||
|                    position:{ | ||||
|                        x:-3.97,   //-0.743    -0.0273   取件点
 | ||||
|                        y:1.68,  //3.00        -0.09
 | ||||
|                        z:0.000 | ||||
|                    }, | ||||
|                    orientation:{ | ||||
|                        x:0.000, | ||||
|                        y:0.000, | ||||
|                        z:0.000, | ||||
|                        w:1.000 | ||||
|                    } | ||||
|                } | ||||
|            } | ||||
|        } | ||||
|    }); | ||||
|    goal.on('feedback', function(feedback) { | ||||
|        console.log('Feedback: ' + feedback.sequence); | ||||
|    }); | ||||
| 
 | ||||
|    goal.on('result', function(result) { | ||||
|        console.log('Final Result: ' + result.sequence); | ||||
|    }); | ||||
| 
 | ||||
|    ros.on('connection', function() { | ||||
|        console.log('Connected to websocket server.'); | ||||
|    }); | ||||
| 
 | ||||
|    ros.on('error', function(error) { | ||||
|        console.log('Error connecting to websocket server: ', error); | ||||
|    }); | ||||
| 
 | ||||
|    ros.on('close', function() { | ||||
|        console.log('Connection to websocket server closed.'); | ||||
|    }); | ||||
| 
 | ||||
|    goal.send(); | ||||
|     var cmdVel = new ROSLIB.Topic({ | ||||
|         ros : ros, | ||||
|         name : '/cmd_vel', | ||||
|         messageType : 'geometry_msgs/Twist' | ||||
|     }); | ||||
| 
 | ||||
|     var twist = new ROSLIB.Message({ | ||||
|         linear : { | ||||
|             x : 0.1, | ||||
|             y : 0.2, | ||||
|             z : 0.3 | ||||
|         }, | ||||
|         angular : { | ||||
|             x : -0.1, | ||||
|             y : -0.2, | ||||
|             z : -0.3 | ||||
|         } | ||||
|     }); | ||||
|     //cmdVel.publish(twist);
 | ||||
| 
 | ||||
					Loading…
					
					
				
		Reference in new issue