Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
XCR | e958202ef9 | 3 years ago |
XCR | a4badd0a90 | 3 years ago |
XCR | 2b7d30f9d0 | 3 years ago |
Before Width: | Height: | Size: 23 MiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 226 KiB |
Before Width: | Height: | Size: 194 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 263 KiB |
Before Width: | Height: | Size: 182 KiB |
Before Width: | Height: | Size: 236 KiB |
Before Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 113 KiB |
Before Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 347 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 188 KiB |
Before Width: | Height: | Size: 263 KiB |
Before Width: | Height: | Size: 490 KiB |
Before Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 102 KiB |
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="E:\SDK\avd\.android\avd\Pixel_XL_API_30.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-07-10T02:39:23.302314100Z" />
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,20 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.example.logistics",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head title="pickup">
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<script type="text/javascript" type="text/javascript">
|
||||
|
||||
function callJS(){
|
||||
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.2,
|
||||
y : 0.0,
|
||||
z : 0.0
|
||||
},
|
||||
angular : {
|
||||
x : 0.0,
|
||||
y : 0.0,
|
||||
z : 0.0
|
||||
}
|
||||
});
|
||||
cmdVel.publish(twist);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Simple roslib Example</h1>
|
||||
<p>Check your Web Console for output.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,139 @@
|
||||
package com.example.logistics.dao;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.example.logistics.entity.User;
|
||||
import com.example.logistics.mysqlconnection.DBOpenHelper;
|
||||
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Connection;
|
||||
|
||||
public class userDao {
|
||||
|
||||
private static final String TAG = "userDao";
|
||||
|
||||
public int login(String username, String password){
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
Connection connection = DBOpenHelper.getConn();
|
||||
|
||||
int msg = 0;
|
||||
try{
|
||||
String sql = "select * from users where username = ?";
|
||||
|
||||
if(connection != null){
|
||||
PreparedStatement ps = connection.prepareStatement(sql);
|
||||
if(ps != null){
|
||||
Log.e(TAG, "username: " + username);
|
||||
ps.setString(1,username);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
int count = rs.getMetaData().getColumnCount();
|
||||
while(rs.next()){
|
||||
for(int i = 1; i <= count; i++){
|
||||
String field = rs.getMetaData().getColumnName(i);
|
||||
map.put(field, rs.getString(field));
|
||||
}
|
||||
}
|
||||
connection.close();
|
||||
ps.close();
|
||||
|
||||
if(map.size() != 0){
|
||||
StringBuilder s = new StringBuilder();
|
||||
for(String key:map.keySet()){
|
||||
if(key.equals("password")){
|
||||
if(password.equals(map.get(key))){
|
||||
msg = 1; //password correct
|
||||
}else{
|
||||
msg = 2; //password incorrect
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Log.e(TAG, "result is null");
|
||||
msg = 3; //result is null
|
||||
}
|
||||
}else{
|
||||
Log.e(TAG, "ps is null");
|
||||
msg = 0;
|
||||
}
|
||||
}else{
|
||||
Log.e(TAG, "connection is null");
|
||||
msg = 0;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
Log.d(TAG, "login bug: " + e.getMessage());
|
||||
msg = 0;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public User findUser(String username){
|
||||
|
||||
Connection connection = DBOpenHelper.getConn();
|
||||
User user = null;
|
||||
try{
|
||||
String sql = "select * from users where username = ?";
|
||||
if(connection != null){
|
||||
PreparedStatement ps = connection.prepareStatement(sql);
|
||||
if(ps != null){
|
||||
ps.setString(1, username);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
while(rs.next()){
|
||||
int userId = rs.getInt(1);
|
||||
String userName = rs.getString(2);
|
||||
String passWord = rs.getString(3);
|
||||
String phoneNum = rs.getString(4);
|
||||
|
||||
user = new User(userId, userName, passWord, phoneNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
public boolean register(User user){
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
Connection connection = DBOpenHelper.getConn();
|
||||
try{
|
||||
String sql = "insert into users(username, password, phonenum) values (?,?,?)";
|
||||
|
||||
if(connection != null){
|
||||
PreparedStatement ps = connection.prepareStatement(sql);
|
||||
|
||||
if(ps != null){
|
||||
ps.setString(1, user.getUserName());
|
||||
ps.setString(2, user.getPassWord());
|
||||
ps.setString(3, user.getPhoneNum());
|
||||
|
||||
int rs = ps.executeUpdate();
|
||||
if(rs > 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "异常 register");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|