Minor refactoring and more support for recording data.
This commit is contained in:
@@ -5,17 +5,28 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.protobuf.Empty;
|
||||
|
||||
import org.vato.carcontroller.LIDAR.LidarTrackingController;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import io.grpc.stub.StreamObserver;
|
||||
|
||||
public class SimpleController extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener {
|
||||
|
||||
private SeekBar steeringSlider;
|
||||
private SeekBar throttleSlider;
|
||||
private Switch recordSwitch;
|
||||
private Switch recordLidarSwitch;
|
||||
|
||||
private static PiLoader grpcController;
|
||||
private PersonTrackingGrpc.PersonTrackingStub trackingStub;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -32,6 +43,7 @@ public class SimpleController extends AppCompatActivity implements SeekBar.OnSee
|
||||
}
|
||||
|
||||
recordSwitch = findViewById(R.id.recordSwitch);
|
||||
recordLidarSwitch = findViewById(R.id.lidarSwitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,4 +109,24 @@ public class SimpleController extends AppCompatActivity implements SeekBar.OnSee
|
||||
public void record(View view) {
|
||||
grpcController.record(recordSwitch.isSelected());
|
||||
}
|
||||
|
||||
public void recordLidar(View view) {
|
||||
StreamObserver<Empty> response = new StreamObserver<Empty>() {
|
||||
@Override
|
||||
public void onNext(Empty value) {
|
||||
Toast.makeText(getApplicationContext(), "Started Recording Lidar", Toast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
Toast.makeText(getApplicationContext(), "Failed to set lidar recording", Toast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,20 +34,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Switch"
|
||||
android:onClick="record"
|
||||
android:text="Record Vehicle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="TextView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Recording" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/saveButton"
|
||||
@@ -55,8 +45,20 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:onClick="saveRecording"
|
||||
android:text="Save"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/lidarSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:onClick="recordLidar"
|
||||
android:text="Record LiDAR"
|
||||
app:layout_constraintStart_toEndOf="@+id/recordSwitch"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user