【注释继电器消息报错逻辑】
【对仿真地图列表排序】
This commit is contained in:
parent
172f65b14c
commit
821aa88a9e
@ -69,7 +69,9 @@ func (r *RccMs) collectRelayState() ([]*state.ReplyState, error) {
|
||||
for _, u := range uidMap {
|
||||
entry, ok := entity.GetEntityByUid(r.vs.World, u.Uid)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("继电器实体不存在: World id=%d, uid=%s", r.vs.World.Id(), u.Uid)
|
||||
// 暂时注释,很多继电器都没初始化
|
||||
//return nil, fmt.Errorf("继电器实体不存在: World id=%d, uid=%s", r.vs.World.Id(), u.Uid)
|
||||
continue
|
||||
}
|
||||
if entry.HasComponent(component.RelayTag) {
|
||||
bit := component.BitStateType.Get(entry)
|
||||
|
@ -25,7 +25,7 @@ func Start(vs *memory.VerifySimulation) {
|
||||
if !ok {
|
||||
sms := &SimulationMs{
|
||||
vs: vs,
|
||||
mss: []ms_api.IMsgServer{},
|
||||
mss: []ms_api.IMsgServer{NewSimulationStateMs(vs)},
|
||||
}
|
||||
for _, mapId := range vs.MapIds {
|
||||
t := memory.QueryOnlyGiType(mapId)
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
type SimulationStateMs struct {
|
||||
vs *memory.VerifySimulation
|
||||
channel string
|
||||
currentState state.SimulationStatus_SimulationState
|
||||
}
|
||||
|
||||
func NewSimulationStateMs(vs *memory.VerifySimulation) *SimulationStateMs {
|
||||
@ -35,6 +36,10 @@ func (s *SimulationStateMs) GetInterval() time.Duration {
|
||||
|
||||
// 构造定时发送的消息
|
||||
func (s *SimulationStateMs) OnTick() ([]*ms_api.TopicMsg, error) {
|
||||
if s.currentState == s.vs.GetRunState() {
|
||||
return nil, nil
|
||||
}
|
||||
s.currentState = s.vs.GetRunState()
|
||||
ststes := &state.SimulationStatus{
|
||||
SimulationId: s.vs.SimulationId,
|
||||
State: s.vs.GetRunState(),
|
||||
|
@ -151,7 +151,11 @@ func QueryProjectPublishedGi(id int32) []*model.PublishedGi {
|
||||
mids[i] = m.Mid
|
||||
}
|
||||
dp := dbquery.PublishedGi
|
||||
publishedGis, _ := dp.Select(dp.ID, dp.Name, dp.Category, dp.Type).Where(dp.ID.In(mids...), dp.Status.Eq(1)).Order(dp.Name).Find()
|
||||
publishedGis, _ := dp.
|
||||
Select(dp.ID, dp.Name, dp.Category, dp.Type).
|
||||
Where(dp.ID.In(mids...), dp.Status.Eq(1)).
|
||||
Order(dp.Type, dp.Name).
|
||||
Find()
|
||||
return publishedGis
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ func NewWaysideMemory() *WaysideMemory {
|
||||
func CreateSimulation(projectId int32, mapIds []int32, runConfig *dto.ProjectRunConfigDto) (*VerifySimulation, error) {
|
||||
// 地图信息
|
||||
sort.Slice(mapIds, func(i, j int) bool {
|
||||
return mapIds[i] < mapIds[j]
|
||||
return QueryOnlyGiType(mapIds[i]) < QueryOnlyGiType(mapIds[j])
|
||||
})
|
||||
verifySimulation := &VerifySimulation{
|
||||
ProjectId: projectId,
|
||||
|
Loading…
Reference in New Issue
Block a user