-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Science panel #36
Conversation
data = [] | ||
msgs = [] | ||
|
||
command_map = { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this 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( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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); | ||
} |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be foreground
add sciencepanel