Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Science panel #36

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Science panel #36

wants to merge 11 commits into from

Conversation

domin746826
Copy link
Contributor

add sciencepanel

data = []
msgs = []

command_map = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe create a config file (.yaml preferably) with those commands? would be great for this driver to be universal_driver where we can control our whole interaction with electronics universal module

self.first_rock_received = False
self.second_rock_received = False

elif msg.data[0] == 1: # sample
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 shouldn't be magic number, write it as constant

Copy link
Member

@kapi117 kapi117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve comments and try to come up with idea how to do interfacing with universal as reusable as possible. In future it would be great to change only configs (where we specify messages and types of components) so that as little extra code as possible is written. Maybe try to do such dynamics that i can input:

type: "weight"
name: "Drill"
tare: [0xD3, 0x0]
request: [0xD3, 0x1]
# or something like
topic: "/universal_driver/drill"

and get appropriate frontend generated. Please try to implement such behavior and apply analogous approach for backend drivers.

self.master_pub = self.create_publisher(
MasterMessage, "master_com/ros_to_master", 10
)
self.master_pub.publish(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is it for?

@@ -166,3 +166,19 @@ export type ArmAxesLocks = {
pitch?: boolean;
yaw?: boolean;
};

export const SCIENCE_TARE_ROCKS = 0x01
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically its not ros interface but some constants, maybe move it elsewhere

[WeightTypes.SAMPLE]: string,
}

export const uiData: UiData = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe more descriptive var name?

import { AutonomyButton, ButtonTypes, ContainerState, WeightTypes } from '../panels/science';
import { ros } from './ros';
import { Service, Topic } from 'roslib';
import { CONTAINER1_CLOSE, CONTAINER1_OPEN, SCIENCE_AUTONOMY_PAUSE, SCIENCE_AUTONOMY_RESET, SCIENCE_AUTONOMY_START, SCIENCE_REQUEST_DRILL, SCIENCE_REQUEST_ROCKS, SCIENCE_REQUEST_SAMPLE, SCIENCE_TARE_DRILL, SCIENCE_TARE_ROCKS, SCIENCE_TARE_SAMPLE } from './ros-interfaces';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least pack it into one struct

@@ -0,0 +1,94 @@
import { AutonomyButton, ButtonTypes, ContainerState, WeightTypes } from '../panels/science';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import should be in other direction - those enums should be in this file and panel should import it

[AutonomyButton.PLAY]: SCIENCE_AUTONOMY_START,
}

type WeightMessage = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the thing that should be in ros interfaces


const cmd = translateAutonomy[whatButton];
setScience.callService({ cmd }, () => {}, undefined);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have prettier configured in vscode for formatting? if no, please install it and format these files with it


});

export function onContainerClicked(state: ContainerState, container: number) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these clicked functions should be in panels code. This file should export function that calls service on set science and it would be called from panel

position: absolute;
pointer-events: none;

margin-left: -58px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have to use such solution, when using absolute position use its left and top positions rather than margins

.info-display {
font-size: medium;
font-weight: 800;
color: var(--yellow-background);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be foreground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants